vikashkodati commited on
Commit
2afdd63
·
1 Parent(s): 108aa01

app for mindsdb hackathon

Browse files
Files changed (3) hide show
  1. README.md +26 -10
  2. app.py +68 -0
  3. requirements.txt +5 -0
README.md CHANGED
@@ -1,13 +1,29 @@
1
  ---
2
- title: Hackathons
3
- emoji: 📊
4
- colorFrom: yellow
5
- colorTo: blue
6
- sdk: streamlit
7
- sdk_version: 1.38.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: openrail
3
+ license_name: open-rail-m
4
+ license_link: https://raw.githubusercontent.com/Clay-foundation/model/main/LICENSE-MODEL.md
 
 
 
 
 
 
5
  ---
6
 
7
+ # Clay Foundation Model
8
+
9
+ ## An open source AI model for Earth
10
+
11
+ Clay is a foundational model of Earth. It uses an expanded visual transformer upgraded to understand geospatial and temporal relations on Earth data. The model is trained as a self-supervised Masked Autoencoder (MAE).
12
+
13
+ The Clay model can be used in three main ways:
14
+ - Generate semantic embeddings for any location and time.
15
+ - Fine-tune the model for downstream tasks such as classification, regression, and generative tasks.
16
+ - Use the model as a backbone for other models.
17
+
18
+
19
+ ## Where is what
20
+
21
+ - Our **website** is [madewithclay.org](https://madewithclay.org).
22
+ - The Clay model **code** lives on [Github](https://github.com/Clay-foundation/model). License: [Apache](https://github.com/Clay-foundation/model/LICENSE). The latest release is [v0.0.1](https://github.com/Clay-foundation/model/releases/tag/v0.0.1)
23
+ - The Clay model **weights** on [Hugging Face](https://huggingface.co/made-with-clay/Clay/). License: [OpenRAIL-M](https://github.com/Clay-foundation/model/blob/main/LICENSE-MODEL.md).
24
+ - The Clay **documentation** [lives on this site](https://clay-foundation.github.io/model/). License: [CC-BY](http://creativecommons.org/licenses/by/4.0/).
25
+ - *Coming Soon* > We maintain a set of **embeddings** on [Source Cooperative](https://beta.source.coop/clay/). License: [ODC-BY](https://opendatacommons.org/licenses/by/).
26
+
27
+ CLAY is a fiscal sponsored project of the 501c3 non-profit [Radiant Earth Foundation](https://www.radiant.earth/).
28
+
29
+
app.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from datetime import date
3
+ import os
4
+ from pydantic import BaseModel, Field, ValidationError
5
+
6
+ class Sentinel2ExportAgent(BaseModel):
7
+ name: str
8
+ role: str
9
+ goal: str
10
+ backstory: str
11
+ project_id: str = Field(..., description="Project ID for Earth Engine")
12
+
13
+ def export_sentinel2_image_to_drive(self, latitude, longitude, start_date, end_date, image_name):
14
+ try:
15
+ st.write(f"Image '{image_name}' with data for the region around Latitude: {latitude}, Longitude: {longitude} "
16
+ f"for the period from {start_date} to {end_date} has been stored in PostgreSQL.")
17
+ st.write("The data is now available in PostgreSQL for further analysis.")
18
+ st.write("Use MindsDB for anomaly detection and data analysis.")
19
+
20
+ return "Data stored in PostgreSQL. You can analyze it using MindsDB Anomaly Detection."
21
+ except Exception as e:
22
+ return f"Error during the process: {e}"
23
+
24
+ # Streamlit app starts here
25
+ st.title("Data Fetcher AI Agent")
26
+
27
+ # Sidebar inputs
28
+ api_key = st.sidebar.text_input("Enter your OpenAI API Key", type="password")
29
+ project_id = st.sidebar.text_input("Enter your Earth Engine Project ID", "genai-agent-hack-2024")
30
+ latitude = st.sidebar.number_input("Latitude", min_value=-90.0, max_value=90.0, value=37.7749, step=0.01)
31
+ longitude = st.sidebar.number_input("Longitude", min_value=-180.0, max_value=180.0, value=-122.4194, step=0.01)
32
+ start_date = st.sidebar.date_input("Start Date", value=date(2021, 6, 1))
33
+ end_date = st.sidebar.date_input("End Date", value=date(2021, 6, 30))
34
+ image_name = st.sidebar.text_input("Image Name", "sentinel2_image")
35
+
36
+ # Function to set the API key
37
+ def set_api_key(key):
38
+ os.environ['OPENAI_API_KEY'] = key
39
+
40
+ # Run the data fetch when button is clicked
41
+ if st.sidebar.button("Fetch Sentinel-2 Image"):
42
+ if not api_key:
43
+ st.error("Please enter your OpenAI API Key.")
44
+ else:
45
+ set_api_key(api_key)
46
+ try:
47
+ # Create the Sentinel2ExportAgent
48
+ sentinel2_agent = Sentinel2ExportAgent(
49
+ name="Sentinel2ExportAgent",
50
+ role="Data Analyst",
51
+ goal="Export Sentinel-2 imagery from Earth Engine to Google Drive",
52
+ backstory="The agent assists in data analysis by exporting high-resolution satellite imagery.",
53
+ project_id=project_id
54
+ )
55
+
56
+ # Fetch and export the image (simulated)
57
+ result = sentinel2_agent.export_sentinel2_image_to_drive(
58
+ latitude, longitude, str(start_date), str(end_date), image_name
59
+ )
60
+
61
+ # Display the result
62
+ st.write(result)
63
+ except ValidationError as e:
64
+ st.error(f"Validation Error: {e}")
65
+
66
+ # Add a note about API key security
67
+ st.sidebar.markdown("---")
68
+ st.sidebar.info("Note: Your API key is not stored and is only used for the current session.")
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ streamlit
2
+ pydantic
3
+ crewai
4
+
5
+