{"id":24794934,"url":"https://github.com/glassflow/example-real-time-ai-alerts","last_synced_at":"2025-10-12T20:30:48.728Z","repository":{"id":221665092,"uuid":"753674009","full_name":"glassflow/example-real-time-ai-alerts","owner":"glassflow","description":"Real-Time Alerts with AI, NATs and Streamlit","archived":false,"fork":false,"pushed_at":"2025-01-02T15:31:12.000Z","size":267,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T19:34:03.857Z","etag":null,"topics":["ai","nats","python","real-time","stream-processing"],"latest_commit_sha":null,"homepage":"https://www.glassflow.dev/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glassflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-06T15:29:11.000Z","updated_at":"2025-01-02T15:31:16.000Z","dependencies_parsed_at":"2024-02-09T10:47:40.439Z","dependency_job_id":"d797f988-c396-451c-bfd0-388680ae54cd","html_url":"https://github.com/glassflow/example-real-time-ai-alerts","commit_stats":null,"previous_names":["glassflow/example-real-time-ai-alerts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glassflow/example-real-time-ai-alerts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassflow%2Fexample-real-time-ai-alerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassflow%2Fexample-real-time-ai-alerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassflow%2Fexample-real-time-ai-alerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassflow%2Fexample-real-time-ai-alerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glassflow","download_url":"https://codeload.github.com/glassflow/example-real-time-ai-alerts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glassflow%2Fexample-real-time-ai-alerts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012800,"owners_count":26085187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","nats","python","real-time","stream-processing"],"created_at":"2025-01-29T23:19:06.017Z","updated_at":"2025-10-12T20:30:48.342Z","avatar_url":"https://github.com/glassflow.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Real-time Weather Alert Chat Application\n\nThis innovative solution combining real-time [weather](https://www.weatherapi.com/) monitoring with AI-powered interactions. This application uses [Streamlit](https://streamlit.io/) for the frontend, Python and [NATS](https://nats.io/) for the backend, and integrates [OpenAI's GPT](https://openai.com/api/) model for decision making, setting alerts and intelligent responses. Read more on this article:\n\nhttps://learn.glassflow.dev/blog/usecases/revolutionizing-real-time-alerts-with-ai-nats-and-streamlit\n\n![How the alert app works demo](/assets/Real-time%20Weather%20Alert%20Chat%20(1).gif)\n\n## Installation\n\nBefore you begin, ensure you have [Python](https://www.python.org/downloads/) and [Docker](https://www.docker.com/products/docker-desktop/) installed on your system. This project requires Python 3.6 or later.\n\n### Clone the Repository\n\nFirst, clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/glassflow/example-real-time-ai-alerts.git\ncd example-real-time-ai-alerts\n```\n\n### Set Up Python Environment\n\nIt's recommended to use a virtual environment for Python projects. Create and activate one using:\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n```\n\n### Install Python Dependencies\n\nInstall the required Python packages:\n\n```bash\npip install -r requirements.txt\n```\n\n### Set Up NATS Server with Docker\n\nEnsure Docker is running on your machine. Then, start the NATS server using Docker Compose:\n\n```bash\ndocker compose up -d\n```\n\n## Configuration\n\n### Environment Variables\n\nCreate a `.env` file in the root directory of the project and add your OpenAI and [Weather API](https://api.weatherapi.com/) keys:\n\n```\nOPENAI_API_KEY=your_openai_api_key\nWEATHER_API_KEY=your_weather_api_key\n```\n\nReplace `your_openai_api_key` and `your_weather_api_key` with your actual API keys.Before running the application, ensure that the environment variables are set. If you're using a virtual environment, you can load them manually:\n\n## Running the Application\n\n### Start the Backend\n\nRun the backend server with:\n\n```bash\npython backend.py\n```\n\n### Start the Streamlit Frontend\n\nIn a new terminal, launch the Streamlit application:\n\n```bash\n\nstreamlit run frontend.py\n```\n\n## Testing the Application\n\n1. **Interact with the Chat**: Open the Streamlit app in your web browser and try sending messages or asking questions.\n2. **Set Weather Alerts**: Use the interface to set custom weather alerts and see how the application responds.\n3. **Monitor NATS Server**: Optionally, you can monitor the NATS server at `http://localhost:8222`.\n\n## Shutting Down\n\nTo stop the application:\n\n1. Close the Streamlit app.\n2. Terminate the backend script (`Ctrl+C` in the terminal).\n3. Stop the NATS server with Docker Compose:\n    \n    ```bash\n    docker compose down\n    ```\n\n## Contributing\n\nContributions to this project are welcome! Please fork the repository and submit a pull request with your changes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglassflow%2Fexample-real-time-ai-alerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglassflow%2Fexample-real-time-ai-alerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglassflow%2Fexample-real-time-ai-alerts/lists"}