diff --git a/backend/app/ner/test.py b/backend/app/ner/test.py index 6acccb00c..73a3add40 100644 --- a/backend/app/ner/test.py +++ b/backend/app/ner/test.py @@ -4,6 +4,7 @@ import cv2 import time + # Run the ner_onnx.py to create the onnx model in the models folder def ner_marking(text1): # change the path is required @@ -167,7 +168,7 @@ def scanning(names): gray, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30) ) - for (x, y, w, h) in faces: + for x, y, w, h in faces: cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 0, 255), 2) cv2.putText( frame, diff --git a/backend/app/routes/images.py b/backend/app/routes/images.py index 23eb5df70..c25062bed 100644 --- a/backend/app/routes/images.py +++ b/backend/app/routes/images.py @@ -287,9 +287,11 @@ def get_class_ids(path: str = Query(...)): class_ids = get_objects_db(path) return ClassIDsResponse( success=True, - message="Successfully retrieved class IDs" - if class_ids - else "No class IDs found for the image", + message=( + "Successfully retrieved class IDs" + if class_ids + else "No class IDs found for the image" + ), data=class_ids if class_ids else "None", ) diff --git a/backend/app/schemas/facetagging.py b/backend/app/schemas/facetagging.py index 7086e7d7d..bd2544a04 100644 --- a/backend/app/schemas/facetagging.py +++ b/backend/app/schemas/facetagging.py @@ -1,6 +1,7 @@ from pydantic import BaseModel from typing import List, Dict + # Response Model class SimilarPair(BaseModel): image1: str diff --git a/docs/Manual_Setup_Guide.md b/docs/Manual_Setup_Guide.md deleted file mode 100644 index dc3b5d917..000000000 --- a/docs/Manual_Setup_Guide.md +++ /dev/null @@ -1,131 +0,0 @@ -## Manual Setup Guide - -### Initial Steps: - -#### 1. Fork the PictoPy repository: https://github.com/AOSSIE-Org/PictoPy - -#### 2. Open your Terminal (Linux/MacOS) or Powershell (Windows) - -#### 3. Clone your forked repository: - -```bash -git clone https://github.com/yourUsername/PictoPy -``` - -#### 4. Change to the repository directory: - -```bash -cd PictoPy -``` - -#### 5. Add the main repository as "upstream": - -```bash -git remote add upstream https://github.com/AOSSIE-Org/PictoPy -``` - -### Tauri Frontend Setup: - -1. **Install Tauri prerequisites based on your OS using this** [guide](https://tauri.app/start/prerequisites/). - -2. **Navigate to the Frontend Directory:** Open your terminal and use `cd` to change directories: - ``` - cd frontend - ``` -3. **Install Dependencies**: - ``` - npm install - ``` -4. **Start the Tauri desktop app in development mode** - ``` - npm run tauri dev - ``` - -### Python (FastAPI) Backend Setup Steps: - -> **Note:** For backend setup make sure that you have **Python version 3.12**. Additionally, for Windows, make sure that you are using Powershell for the setup, not command prompt. - -1. **Navigate to the Backend Directory:** Open your terminal and use `cd` to change directories: - - Bash - - ``` - cd backend - ``` - -2. **Set Up a Virtual Environment (Highly Recommended):** Virtual environments isolate project dependencies. Create one using: - - Bash(Linux/MacOS) - - ``` - python3 -m venv .env - ``` - - Powershell(Windows) - - ``` - python -m venv .env - ``` - -3. **Activate the Virtual Environment:** - - Bash(Linux/MacOS) - - ``` - source .env/bin/activate - ``` - - Powershell(Windows) - - ``` - .env\Scripts\activate.ps1 - ``` - - After activating, you should be able to see the virtual environment's name before the current path. Something like this: - - ![alt text](/docs/assets/screenshots/virtualEnv.png) - -4. **Install Dependencies:** The `requirements.txt` file lists required packages. Install them using pip: - - Bash - - ``` - pip install -r requirements.txt - ``` - -5. **Running the backend:**: To start the backend in development mode, run this command while being in the backend folder and the virtual environment activated: - - Bash/Powershell - - ``` - fastapi dev - ``` - - The server will start on `http://localhost:8000` by default. In test mode, the server will automatically restart if any errors are detected or if source files are modified. - - ![alt text](/docs/assets/screenshots/serverRunning.png) - -6. **Missing System Dependencies:** Some dependencies might need system-level libraries like `libGL.so.1` (often needed by OpenCV). Install the appropriate packages based on your distribution: - - **Debian/Ubuntu:** - - Bash - - ``` - sudo apt update - sudo apt install -y libglib2.0-dev libgl1-mesa-glx - - ``` - - **Other Systems:** Consult your distribution's documentation for installation instructions. - -7. **`gobject-2.0` Not Found Error:** Resolve this error by installing `libglib2.0-dev` (Debian/Ubuntu): - - Bash - - ``` - sudo apt install -y libglib2.0-dev pkg-config - - ``` - - For other systems, consult your distribution's documentation. diff --git a/docs/Script_Setup_Guide.md b/docs/Script_Setup_Guide.md deleted file mode 100644 index f2e08f73f..000000000 --- a/docs/Script_Setup_Guide.md +++ /dev/null @@ -1,80 +0,0 @@ -## Setting Up using Script - -### Video Setup Guide: - -- [Windows](https://youtu.be/nNVAE4or280?si=j_y9Xn8Kra6tPHjw) -- [Ubuntu (Debian)](https://www.youtube.com/watch?v=a7I0ZRE-SHk) - -### Prerequisites: - -- [NodeJS](https://nodejs.org/en) (LTS Version Recommended) -- [Git](https://git-scm.com/downloads) version control system - -### Steps Performed in the Video: - -1. Fork the PictoPy repository: https://github.com/AOSSIE-Org/PictoPy - -2. Open your terminal (or Powershell with administrator privileges on Windows) - -3. Clone your forked repository: - - ```bash - git clone https://github.com/yourUsername/PictoPy - ``` - -4. Change to the repository directory: - - ```bash - cd PictoPy - ``` - -5. Add the main repository as "upstream": - - ```bash - git remote add upstream https://github.com/AOSSIE-Org/PictoPy - ``` - -6. Run the Automatic Setup - - ```bash - npm run setup - ``` - - > **Note:** This step can take a long time depending on your internet connection and system specifications. If the script seems to stop progressing after waiting for more than 10 minutes, press Enter in your terminal window to continue. - -7. Start the Backend Server - - #### Windows - - ```powershell - cd .\backend - .env\Scripts\activate.ps1 - fastapi dev - ``` - - #### Linux - - ```bash - cd ./backend - source .env/bin/activate - fastapi dev - ``` - -8. Start the Frontend Desktop App - - Open a new terminal window, navigate to the project directory, and run: - - ```bash - cd frontend - npm run tauri dev - ``` - -9. Pre-commit Setup - - Before running the `git commit` command, ensure you have the following Python packages installed globally: - - ```bash - pip install ruff black mypy pre-commit - ``` - - > **Note:** If you are committing from a virtual environment, these packages should already be installed as they are included in the requirements.txt file. diff --git a/docs/backend/backend_python/setup.md b/docs/backend/backend_python/setup.md deleted file mode 100644 index 82496f0ea..000000000 --- a/docs/backend/backend_python/setup.md +++ /dev/null @@ -1,24 +0,0 @@ -# Python Backend Setup - -## Setup Directory - -!!! note "Base Directory" -All commands executed below are with respect to the `backend/` directory - -### Installing requirments - -We suggest setting up a virtual environment and run the following command - -```bash -pip install -r requirements.txt -``` - -The entry point for backend is `main.py` , since PictoPy is built on top of FastAPI, we suggest using the `run` scripts which are available in both -`.bat` and `.sh` formats. - -!!! note "UNIX Development" -For UNIX based systems, to run in development mode run -`bash - ./run.sh --test - ` -The backend should now be successfully running on port 8000 by default. To change this modify the start-up scripts. diff --git a/docs/backend/backend_rust/setup.md b/docs/backend/backend_rust/setup.md deleted file mode 100644 index 0a14a9ea9..000000000 --- a/docs/backend/backend_rust/setup.md +++ /dev/null @@ -1,51 +0,0 @@ -# Rust Backend Setup - -## Prerequisites - -Before setting up the frontend, ensure you have the following installed: - -- [Node.js](https://nodejs.org/) (LTS version recommended) -- npm (comes with Node.js) -- [Rust](https://www.rust-lang.org/tools/install) (latest stable version) -- [Tauri CLI](https://v2.tauri.app/start/prerequisites/) - -For a comprehensive guide on prerequisites, refer to the [Tauri Prerequisites](https://v2.tauri.app/start/prerequisites/) documentation. - -## Setup Directory - -!!! note "Base Directory" -All commands executed below are with respect to the `frontend/` directory - -### Installing Dependencies - -1. Navigate to the frontend directory: - - ```bash - cd frontend - ``` - -2. Install the project dependencies: - ```bash - npm install - ``` - -For more information on npm commands, see the [npm documentation](https://docs.npmjs.com/). - -## Running the Application - -To start the Tauri application in development mode, run: - -```bash -npm run tauri dev -``` - -This command will: - -- Start the [Vite](https://vitejs.dev/) development server for the frontend -- Compile the Rust backend -- Launch the Tauri application window - -For more details on Tauri commands, check the [Tauri CLI documentation](https://tauri.app/v1/api/cli). - -!!! note "First Run" -The first run might take longer as it needs to compile the Rust code. diff --git a/docs/backend/docker-setup.md b/docs/backend/docker-setup.md deleted file mode 100644 index d06cb7d46..000000000 --- a/docs/backend/docker-setup.md +++ /dev/null @@ -1,107 +0,0 @@ -# Backend Docker Setup for PictoPy - -This guide provides step-by-step instructions for building and running the PictoPy backend using Docker. - -## Table of Contents - -1. [Prerequisites](#prerequisites) -2. [Building the Docker Image](#building-the-docker-image) -3. [Running the Docker Container](#running-the-docker-container) -4. [Verifying the Container](#verifying-the-container) -5. [Accessing the Application](#accessing-the-application) -6. [Stopping the Container](#stopping-the-container) -7. [Troubleshooting](#troubleshooting) - -## Prerequisites - -Before you begin, ensure you have the Docker installed on your machine - -- Verify the installation by running: - ```bash - docker --version - ``` - -## Building the Docker Image - -1. Open a terminal and navigate to your project's root directory. - -2. Go to Backend directory - - ```bash - cd backend - ``` - -3. Run the following command to build the Docker image, replacing `` with your desired image name: - - ```bash - docker build -t . - ``` - -4. Wait for the build process to complete. This may take a few minutes depending on your internet speed and system performance. - -## Running the Docker Container - -Once the image is built, you can run a container using the following command: - -```bash -docker run -it --name backend-container -p 8000:8000 \ --v images-data:/app/images \ --v /:/host \ - -``` - -- `-it`: Runs the container interactively, attaching to the terminal for input/output. -- `-p 8000:8000`: Maps port 8000 on the host to port 8000 in the container. -- `-v`: Mounts a volume to share data between the host and container. -- ``: Specifies the image to use (the one we just built). - -## Verifying the Container - -To check if the container is running: - -```bash -docker ps -``` - -You should see an entry for `` with the status `Up`. - -## Accessing the Application - -Open a web browser or frontend to access the application at: - -``` -http://localhost:8000 -``` - -## Stopping the Container - -If you need to stop the container: - -```bash -docker kill -``` - -## Troubleshooting - -1. **Port already in use**: If you get an error saying the port is already in use, you can either: - - - Stop the process using port 8000, or - - Change the port mapping in the `docker run` command (e.g., `-p 8001:8000`) - -2. **Container exits immediately**: Check the container logs: - - ```bash - docker logs - ``` - -3. **Permission issues**: Ensure that `run.sh` has execute permissions(for linux only): - - ```bash - chmod +x run.sh - ``` - - Then rebuild the Docker image. - -Remember to rebuild your Docker image (`docker build -t .`) after making any changes to your application or Dockerfile. - -For more advanced Docker usage , view the [Docker documentation](https://docs.docker.com/get-started/). diff --git a/docs/frontend/docker-setup.md b/docs/frontend/docker-setup.md deleted file mode 100644 index d1c9c23bb..000000000 --- a/docs/frontend/docker-setup.md +++ /dev/null @@ -1,129 +0,0 @@ -# Docker Setup for PictoPy Frontend - -This guide provides instructions for building and running the PictoPy frontend using Docker. - -## Table of Contents - -1. [Prerequisites](#prerequisites) -2. [Building the Docker Image](#building-the-docker-image) -3. [Running the Container](#running-the-container) - - [Linux](#linux) - - [Windows](#windows) -4. [Accessing the GUI App](#accessing-the-gui-app) -5. [Common Troubleshooting](#common-troubleshooting) -6. [Notes on Cross-Platform Compatibility](#notes-on-cross-platform-compatibility) - -## Prerequisites - -- Docker installed on your system -- For Windows: An X Server (e.g., VcXsrv or Xming) -- For Linux : An X server also installed - ```bash - sudo apt install x - ``` - -## Building the Docker Image - -1. Open a terminal and navigate to your project's root directory. - -2. Go to Frontend directory - - ```bash - cd frontend - ``` - -3. Run the following command to build the Docker image, replacing `` with your desired image name: - - ```bash - docker build --build-arg TAURI_SIGNING_PRIVATE_KEY= --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD= -t . - ``` - - Replace and with your actual Tauri signing private key and password and with the image name. If you are using the default key, you can use the following command: - - ```bash - docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass -t . - ``` - -## Running the Container - -### Linux - -1. Allow X11 forwarding: - - ```bash - xhost +local:docker - ``` - -2. Run the container: - - ```bash - docker run -it --name frontend-container --network host -p 1420:1420 -e DISPLAY=${DISPLAY} \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -v images-data:/app/images \ - -v /:/host \ - - ``` - -### Windows - -1. Start an X Server: - - - Launch VcXsrv or Xming. - - Configure it to allow connections from any host. - -2. Find your host machine's IP address: - - - Open Command Prompt and run `ipconfig`. - - Look for the IPv4 Address under your active network adapter. - -3. Run the container: - - ```bash - docker run -it -p 1420:1420 -e DISPLAY=:0.0 - ``` - -Replace `` with your actual IP address. - -4. Run the tauri application - ```bash - npm run tauri dev - ``` - -## Building the Tauri App - -### Linux - -```bash - npm run tauri build -``` - -### Windows - -```bash - npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc -``` - -## Accessing the GUI App - -If everything is configured correctly, the Tauri GUI app should display on your screen after running the container. - -## Common Troubleshooting - -### 1. GUI Not Displaying (X Server Issues) - -- **Windows**: - - - Ensure the X server (VcXsrv or Xming) is running. - - Check that it's configured to allow connections from any host. - -- **Linux**: - - Verify X11 forwarding is allowed: `xhost +local:docker` - -### 2. Network Issues - -If the container can't connect to the X server: - -1. Check your firewall settings and ensure it's not blocking the connection. -2. On Windows, try using the host's IP address instead of localhost. - -By following this guide and keeping these notes in mind, you should be able to successfully set up and run the PictoPy frontend using Docker across different platforms. If you encounter any persistent issues, please refer to the project's issue tracker or seek assistance from the development team. diff --git a/docs/frontend/setup.md b/docs/frontend/setup.md deleted file mode 100644 index d1332ea62..000000000 --- a/docs/frontend/setup.md +++ /dev/null @@ -1,125 +0,0 @@ -# Frontend Setup - -## Prerequisites - -Before setting up the frontend, ensure you have the following installed: - -- [Node.js](https://nodejs.org/) (LTS version recommended) -- npm (comes with Node.js) -- [Rust](https://www.rust-lang.org/tools/install) (latest stable version) -- [Tauri CLI](https://v2.tauri.app/start/prerequisites/) - -For a comprehensive guide on prerequisites, refer to the [Tauri Prerequisites](https://v2.tauri.app/start/prerequisites/) documentation. - -## Setup Directory - -!!! note "Base Directory" -All commands executed below are with respect to the `frontend/` directory - -### Installing Dependencies - -1. Navigate to the frontend directory: - - ```bash - cd frontend - ``` - -2. Install the project dependencies: - - - For Windows/Mac - - ```bash - npm install - ``` - - - For Linux - - 1.Installing Dependencies - - ```bash - npm install - ``` - - 2.Grant executable permissions to the setup script: - - ```bash - chmod +x scripts/setup_env.sh - ``` - - 3.Run the dependencies script - - ```bash - npm run setup:linux - ``` - -For more information on npm commands, see the [npm documentation](https://docs.npmjs.com/). - -## Running the Application - -To start the Tauri application in development mode, run: - -```bash -npm run tauri dev -``` - -This command will: - -- Start the [Vite](https://vitejs.dev/) development server for the frontend -- Compile the Rust backend -- Launch the Tauri application window - -For more details on Tauri commands, check the [Tauri CLI documentation](https://tauri.app/v1/api/cli). - -!!! note "First Run" -The first run might take longer as it needs to compile the Rust code. - -## Building for Production - -To create a production build of your Tauri application: - -Create Signing Keys for tauri using the command: - -```bash -npm run tauri signer generate -``` - -Set the public key in tauri.conf.json as pubkey and private key and password in Enviroment Variables as TAURI_SIGNING_PRIVATE_KEY and TAURI_SIGNING_PRIVATE_KEY_PASSWORD - -There is a preset pubkey in tauri.conf.json ; private key and password for it is: - -```bash -TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== -``` - -```bash -TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass -``` - -```bash -npm run tauri build -``` - -This will create an optimized build of your application in the `src-tauri/target/release` directory. - -Learn more about building Tauri apps in the [Tauri Building Guide](https://tauri.app/v1/guides/building/). - -## Troubleshooting - -If you encounter any issues during setup or running the application: - -1. Ensure all prerequisites are correctly installed. -2. Check that you're in the correct directory (`frontend/`). -3. Try deleting the `node_modules` folder and `package-lock.json` file, then run `npm install` again. -4. If Rust-related errors occur, try running `rustup update` to ensure you have the latest version. - -For more detailed troubleshooting, refer to the [Tauri Troubleshooting Guide](https://tauri.app/v1/guides/debugging/debugging/). - -## Additional Resources - -- [Tauri Documentation](https://tauri.app/v1/guides/) -- [Vite Documentation](https://vitejs.dev/guide/) -- [React Documentation](https://reactjs.org/docs/getting-started.html) -- [TypeScript Documentation](https://www.typescriptlang.org/docs/) -- [Rust Book](https://doc.rust-lang.org/book/) - -By following these steps, you should have your Tauri frontend environment set up and ready for development. Remember to run `npm run tauri dev` to start your development environment. diff --git a/docs/setup.md b/docs/setup.md new file mode 100644 index 000000000..6eecee4b0 --- /dev/null +++ b/docs/setup.md @@ -0,0 +1,17 @@ +# Setup Instructions + +**Please refer to the [README.md](https://github.com/AOSSIE-Org/PictoPy/blob/main/README.md#setup) file for complete setup instructions.** + +## Available Setup Methods + +The README.md file contains detailed instructions for: + +1. **Script Setup (Recommended)** - Automated setup using our setup script +2. **Manual Setup** - Step-by-step manual installation +3. **Docker Setup** - Using Docker and Docker Compose + +## Quick Links + +- [Main Repository](https://github.com/AOSSIE-Org/PictoPy) +- [Setup Section in README](https://github.com/AOSSIE-Org/PictoPy/blob/main/README.md#setup) +- [Troubleshooting](https://github.com/AOSSIE-Org/PictoPy/blob/main/README.md#troubleshooting) diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index 72cbbb957..914cf3960 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -48,6 +48,8 @@ "title": "PictoPy", "width": 800, "height": 600, + "minWidth": 1280, + "minHeight": 720, "resizable": true, "fullscreen": false, "maximized": false diff --git a/frontend/src/components/Album/Album.tsx b/frontend/src/components/Album/Album.tsx index 45681613a..a247c83bf 100644 --- a/frontend/src/components/Album/Album.tsx +++ b/frontend/src/components/Album/Album.tsx @@ -34,9 +34,12 @@ const AlbumsView: React.FC = () => { } | null>(null); if (isLoading) -
- -
; + return ( +
+ +
+ ); + const showErrorDialog = (title: string, err: unknown) => { setErrorDialogContent({ title, @@ -49,7 +52,9 @@ const AlbumsView: React.FC = () => { return (
-

Albums

+

+ Albums +

-
No albums found.
+
+ No albums found. +
setIsCreateFormOpen(false)} @@ -114,7 +121,9 @@ const AlbumsView: React.FC = () => { ) : ( <>
-

Albums

+

+ Albums +