Spaces:
No application file
A newer version of the Streamlit SDK is available:
1.54.0
title: My Streamlit Demo
emoji: π
colorFrom: red
colorTo: red
sdk: streamlit
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Fetch and display real-time weather data for any city.
Welcome to Streamlit!
Edit /src/streamlit_app.py to customize this app to your heart's desire. :heart:
If you have any questions, checkout our documentation and community forums.
π¦οΈ Weather Information App
A simple Streamlit application that fetches and displays real-time weather data for any city in the world using the OpenWeatherMap API.
The app also gives practical suggestions (e.g., bring a jacket or umbrella) along with weather icons.
π Features
- Fetch current weather data from OpenWeatherMap API
- Displays:
- π‘οΈ Temperature (Β°C)
- π§ Humidity (%)
- π Weather description
- π Personalized suggestion with an icon
- Clean layout: image on the left, advice & details on the right
π§ͺ Python Version
This app was developed using: Python 3.10
π Demo
Deployed on [Hugging Face Spaces] https://huggingface.co/spaces/SharmilNK/my-streamlit-demo
π Project Structure
Assignment/
βββ streamlit_app.py # Main Streamlit app
βββ requirements.txt # Dependencies
βββ README.md
βββ images/ # Weather image icons
β βββ chill.jpg
β βββ cloudy.jpg
β βββ rain.jpg
β βββ shower.jpg
β βββ sun.jpg
β βββ weather.jpg
Setup Instructions
1. Clone the Repo
1. git clone https://github.com/SharmilNK/WeatherApp-using-Streamlit_W5CH2.git
cd Assignment
2. Create & activate a virtual environment (optional but recommended)
python -m venv venv
venv\Scripts\activate # On Windows
source venv/bin/activate # On Mac/Linux
3. Create a .env file
Inside Assignment/, create a file called .env and add your API key:
OPENWEATHER_API_KEY=your_api_key_here
4. Install dependencies
pip install -r requirements.txt
5. Run the Streamlit app
streamlit run app.py
5. Deploy to Hugging Face Spaces
6. Go to your Space's Settings tab
Use "Secrets" to securely store your API key
### 2.Run on Hugging Face Spaces
1. Upload the following files:
main.py
requirements.txt
.streamlit/config.toml
images/ folder (with weather icons)
README.md
2. Set your API key:
Go to your Space β Settings β Secrets
Add a key like:
OPENWEATHER_API_KEY = your_key_here
The app will automatically reload and work!
π Acknowledgements
OpenWeatherMap API
Streamlit
Hugging Face Spaces