A simple weather app built with Python and Streamlit that uses OpenAI's API to provide current weather information for any city.
https://www.udemy.com/course/claude-code-customizing-for-your-team
- Simple and intuitive user interface
- Get current weather for any city worldwide
- Weather details include temperature, conditions, humidity, and wind speed
- Dark mode toggle for comfortable viewing in any lighting condition
- Refresh button to clear weather data and start fresh
- Session state management for persistent weather display
- Responsive error handling with user-friendly messages
- Powered by OpenAI's GPT-3.5 model
- Python 3.8 or higher
- OpenAI API key (get one at https://platform.openai.com/api-keys)
-
Clone or download this repository
-
Create a Python virtual environment:
# Create virtual environment python -m venv .venv # Activate virtual environment # On macOS/Linux: source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the project root directory with your OpenAI API key:OPENAI_API_KEY=your_actual_api_key_here
Run the Streamlit app:
streamlit run app.pyThe app will open in your default web browser at http://localhost:8501.
- Enter a city name in the text input field (e.g., New York, London, Tokyo)
- Click "Get Weather" to fetch current weather information for that city
- Toggle dark mode using the moon/sun icon in the top right corner
- Click "Refresh" to clear the current weather data and start fresh
brezy-weather/
├── app.py # Main Streamlit application with dark mode and session state
├── requirements.txt # Python dependencies
├── .env # Environment variables (API keys)
├── .streamlit/ # Streamlit configuration directory
├── .venv/ # Virtual environment
└── README.md # This file
This app uses OpenAI's API to generate weather information. Please note that:
- You need a valid OpenAI API key
- API usage may incur costs based on your OpenAI plan
- For real-time weather data, consider integrating with a weather API service