| --- |
| 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. |
|
|