A simple web application built with FastAPI that provides multiple AI-powered features:
- Text translation (English β French)
- Sentiment analysis
- Person detection in images using YOLOv8
The app uses modern ML models and is served through a Jinja2 HTML template interface.
- Translation: Translate English text to French using Hugging Face Transformers.
- Sentiment Analysis: Analyze the sentiment of any given text.
- Object Detection: Detect people in uploaded images using YOLOv8 from Ultralytics.
| Library | Purpose |
|---|---|
| FastAPI | Backend framework for building APIs |
| Transformers | For NLP tasks like translation and sentiment analysis |
| YOLOv8 (Ultralytics) | For real-time object detection in images |
| Torch (PyTorch) | Machine learning backend used by both Transformers and YOLO |
| OpenCV | Image manipulation and saving annotated results |
| Jinja2 | HTML templating engine |
| Uvicorn | ASGI server to run the FastAPI app |
git clone https://github.com/ectorr01/fastapi-multi-function-app.git
cd fastapi-multi-function-apppython -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windowspip install -r requirements.txtuvicorn main:app --reloadGo to: http://localhost:8000
fastapi-multi-function-app/
βββ main.py
βββ requirements.txt
βββ templates/
β βββ index.html
βββ static/
Make sure you have installed:
- Python 3.8+
- FastAPI
- Uvicorn
- Transformers
- Torch
- Ultralytics (YOLO)
- OpenCV (
opencv-python-headless) - Jinja2
All required packages are listed in requirements.txt.