This is a simple image recognition app built using FastAPI and Streamlit. It allows users to upload an image, perform object detection using a pre-trained model, and visualize the detection results with bounding boxes.
Check out the demo video to see the app in action.
- Python 3.7 or higher
- FastAPI
- Streamlit
- Torch
- torchvision
- Pillow
- Matplotlib
- Requests
-
Clone the repository:
git clone https://github.com/Shikha-code36/ImageDetection-FastApi.git
-
Navigate to the project directory:
cd ImageDetection-FastApi
-
Install the required packages using pip:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn app.main:app --reload # for development environment with auto reload on code changes
The server will be running at http://127.0.0.1:8000.
-
Run the Streamlit app:
streamlit run app.py
The app will be accessible at http://localhost:8501 in your web browser.
-
Use the Image Recognition App:
- Upload an image by clicking on the "Choose an image" button.
- The uploaded image will be displayed.
- Click on the "Detect Objects" button to perform object detection.
- Bounding boxes will be drawn around the detected objects with their corresponding class labels and confidence scores.
Note: Make sure the FastAPI server is running before using the Streamlit app.
- The app uses the
ssdlite320_mobilenet_v3_large model
from the torchvision library for object detection. - The available classes for object detection are defined in the
CLASSES
list inmain.py
. Modify the list as per your requirements.
This project is licensed under the MIT License.