Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bhimrazy/image-recognition-app-using-fastapi-and-pytorch

This is an image recognition application based on the FastAPI framework and PyTorch which uses pretrained DenseNet 121 model to detect the image.
https://github.com/bhimrazy/image-recognition-app-using-fastapi-and-pytorch

densenet-pytorch fastapi jinja2 python pytorch tailwindcss

Last synced: 3 months ago
JSON representation

This is an image recognition application based on the FastAPI framework and PyTorch which uses pretrained DenseNet 121 model to detect the image.

Awesome Lists containing this project

README

        





Image Recognition App using FastAPI and PyTorch

In this project, I have tried to build and deploy an Image Recognition App using FastAPI and
PyTorch.

## Tutorial Youtube gif

[![fastapi pytorch image recognition](https://user-images.githubusercontent.com/46085301/143211855-fe73e3b0-fc8c-4aa4-8428-e93cc16d6dfd.png)](https://youtu.be/7Rm5mGhYWVI)

## Installation
Run my Project

```bash
git clone https://github.com/bhimrazy/Image-Recognition-App-using-FastAPI-and-PyTorch
cd Image-Recognition-App-using-FastAPI-and-PyTorch
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload
```
## Image Recognition App using FastAPI and PyTorch: TODO
- [x] Create a virtual environment
- [x] Create FastAPI App
- Install fast API
- Install Uvicorn
- Install Pytest
- Install Jinja2
- Install python-multipart
- Install requests
- Create a main file with some routes
- Create a main test file to test the home page route

- [x] Pytorch Setup
- Install torch & torchvision (use cpu version for small size)

- [x] Prediction
- Create a predict post route
- Create a file utils.py
- Test predict route
- Create some helper function
- Put some test images inside static folder
- Create a test to upload an image in predict route
- Predict

- [x] Create a home page for prediction
- Create an index.html file inside the templates directory
- Setup template and static directory in the main app
- Initial HTML for home page
- Use Tailwind CSS cdn link for css
- Google Fonts
- Create a form to predict
- update homepage route for prediction
- Update UI of the page
- Add Some javascript to autoload the image
- Add logo and favicon
- Add meta tags
- Add response image for preview as base64 data

## 📚 RESOURCES:
â—† PyTorch: https://pytorch.org/tutorials/intermediate/flask_rest_api_tutorial.html

â—† FastAPI: https://fastapi.tiangolo.com

## Author
- [@bhimrazy](https://www.github.com/bhimrazy)