UFO-web / README.md
Coco-Spot
Deploy UFO app to Hugging Face Space
3b317d3
|
Raw
History Blame Contribute Delete
1.87 kB
---
title: UFO Web
emoji: πŸ›Έ
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.58.0
app_file: app.py
pinned: false
---
# UFO Country Predictor
Session 406 machine-learning web app practice project. It predicts the likely reporting country for a UFO sighting from duration, latitude, and longitude.
## Project Structure
```text
UFO_local/
β”œβ”€β”€ app.py # Hugging Face Spaces Streamlit app
β”œβ”€β”€ backend.py # FastAPI backend for local deployment practice
β”œβ”€β”€ frontend.py # Streamlit frontend that calls the FastAPI backend
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ ufo-model.pkl
└── course_materials/ # Session 406 task guide and original Flask reference
```
## Local FastAPI + Streamlit Workflow
Install dependencies:
```bash
conda activate session406
pip install -r requirements.txt
```
Start the FastAPI backend:
```bash
uvicorn backend:app --reload --host 127.0.0.1 --port 8001
```
Start the Streamlit frontend in another terminal:
```bash
streamlit run frontend.py --server.address 127.0.0.1 --server.port 8501
```
Open:
```text
http://127.0.0.1:8501
```
## Hugging Face Spaces Workflow
Hugging Face Spaces runs `app.py` directly as a single Streamlit app. This version loads `ufo-model.pkl` itself, so it does not need the FastAPI backend.
Create or open the Space:
```text
https://huggingface.co/spaces/Coco-Spot/UFO-web
```
Push this project to the Space repository:
```bash
git remote add hf https://huggingface.co/spaces/Coco-Spot/UFO-web
git push hf main
```
When prompted, use your Hugging Face username and a write token from:
```text
https://huggingface.co/settings/tokens
```
## Course Materials
The original session files are kept in `course_materials/session-406-ml-app/`, including the UFO Flask practice guide, original solution, data file, and task roadmap.