SeismicAI is an interactive web application built with Streamlit, designed to fetch, analyze, and visualize seismic data from the U.S. Geological Survey (USGS) Earthquake Hazards Program API. It provides users with insights into earthquake data, allowing them to visualize seismic events on a map and interact with the data through a simple chat interface. The app is intended for educational and informational purposes and does not forecast earthquakes.
- Fetch seismic data from the USGS API based on user-selected date ranges.
- Data analysis and insights, including statistical summaries and trend analysis.
- Visualization of earthquake data on a map, highlighting events with a magnitude greater than 4.0.
- A chat interface that allows users to ask questions about the seismic data, with examples provided.
- Customizable date input for data fetching, enabling users to explore seismic events within specific time frames.
- Select Date Range: Use the sidebar to input the start and end dates for fetching seismic data. The default range is the past seven days.
- View Map Visualization: The main area displays a map visualization of earthquakes with a magnitude greater than 4.0, based on the selected date range.
- Read General Summary: Expand the "General Summary" section to view statistical insights into the fetched seismic data.
- Ask Questions: Use the "Seismic Chat" section in the sidebar to ask specific questions about the seismic data. You can select an example query or type your own question and press "Ask" to submit.
- Python Libraries: The app utilizes
requests
for API requests,pandas
andpandasai
for data manipulation,plotly.express
for data visualization, anddatetime
andnumpy
for handling dates and numerical operations. - Data Source: Seismic data is fetched from the USGS Earthquake Hazards Program API.
- Chat Interface: Implemented using the
pandasai
library'sSmartDataframe
class and OpenAI's API for natural language processing and interaction.
To run SeismicAI locally, follow these steps:
-
Clone the repository:
git clone https://github.com/jamesdesantiago/SeismicAI.git cd SeismicAI
-
Install the required Python packages:
pip install -r requirements.txt
-
Set up your OpenAI API key:
- Obtain an API key from OpenAI.
- Create a file named
.streamlit/secrets.toml
and add your OpenAI API key:openai_api_key = "your_api_key_here"
-
Run the app:
streamlit run app.py
-
The app will start running locally. Open the provided URL in a web browser to use SeismicAI.
Contributions to SeismicAI are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Implement your changes.
- Submit a pull request with a clear description of your changes.
SeismicAI is released under the Apache-2.0 License. See the LICENSE
file for more details.
SeismicAI was created by James De Santiago. Data is sourced from the U.S. Geological Survey (USGS) Earthquake Hazards Program.
Please note that this documentation is a generic template and should be customized to fit the specific features and functionalities of your version of SeismicAI.