Plinio Guzman commited on
Commit
69cbc6e
2 Parent(s): fdda1da 118d992

Merge pull request #1 from openbiodiversity/feat/gee

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. README.md +58 -0
  3. app.py +13 -3
  4. requirements.txt +5 -0
.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  .venv
2
  __pycache__/
 
 
1
  .venv
2
  __pycache__/
3
+ service_account.json
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Bioscore calculator app
2
+
3
+ This is a simple guide to help you set up and run a Gradio app.
4
+
5
+ ## Prerequisites
6
+
7
+ - Python 3 installed on your system
8
+ - venv module for creating a virtual environment (usually comes with Python)
9
+
10
+ ## Installation
11
+
12
+ Clone the repository to your local machine:
13
+ ```bash
14
+ git clone https://github.com/your-username/gradio-app.git
15
+ cd gradio-app
16
+ ```
17
+
18
+ Set up the service account credentials:
19
+ - Obtain a service account key file (in JSON format) with the necessary permissions to access any external services required by your Gradio app.
20
+ - Save the service account key file as `service_account.json` in the project directory.
21
+
22
+ Create and activate a virtual environment:
23
+ ```bash
24
+ python3 -m venv venv
25
+ source venv/bin/activate
26
+ ```
27
+
28
+ Install the required Python packages:
29
+ ```bash
30
+ pip3 install -r requirements.txt
31
+ ```
32
+
33
+ ## Running the App
34
+
35
+ To start the Gradio app, execute the following command:
36
+
37
+ ```bash
38
+ gradio app.py
39
+ ```
40
+
41
+ The app will start running, and you should see output similar to the following:
42
+
43
+ ```
44
+ Running on http://127.0.0.1:7860
45
+ Open your web browser and visit http://127.0.0.1:7860 to access the Gradio app.
46
+ ```
47
+
48
+ ## Customization
49
+
50
+ Feel free to modify the app.py file to customize the behavior and appearance of your Gradio app. You can add or remove input and output interfaces, change their appearance, or include additional functionality as per your requirements.
51
+
52
+ ## Feedback
53
+
54
+ If you encounter any issues or have any questions or suggestions, please don't hesitate to open an issue on the GitHub repository. We appreciate your feedback and contributions!
55
+
56
+ ## License
57
+
58
+ This project is licensed under the MIT License.
app.py CHANGED
@@ -1,7 +1,15 @@
1
  import gradio as gr
2
  import plotly.graph_objects as go
3
  from datasets import load_dataset
 
 
4
 
 
 
 
 
 
 
5
  dataset = load_dataset("gradio/NYC-Airbnb-Open-Data", split="train")
6
  df = dataset.to_pandas()
7
 
@@ -43,10 +51,12 @@ def filter_map(min_price, max_price, boroughs):
43
  with gr.Blocks() as demo:
44
  with gr.Column():
45
  with gr.Row():
46
- min_price = gr.Number(value=250, label="Minimum Price")
47
- max_price = gr.Number(value=1000, label="Maximum Price")
48
- boroughs = gr.CheckboxGroup(choices=["Queens", "Brooklyn", "Manhattan", "Bronx", "Staten Island"], value=["Queens", "Brooklyn"], label="Select Boroughs:")
49
  btn = gr.Button(value="Update Filter")
 
 
50
  map = gr.Plot().style()
51
  demo.load(filter_map, [min_price, max_price, boroughs], map)
52
  btn.click(filter_map, [min_price, max_price, boroughs], map)
 
1
  import gradio as gr
2
  import plotly.graph_objects as go
3
  from datasets import load_dataset
4
+ import ee
5
+ # import geemap
6
 
7
+ # GEE
8
+ service_account = 'climatebase-july-2023@ee-geospatialml-aquarry.iam.gserviceaccount.com'
9
+ credentials = ee.ServiceAccountCredentials(service_account, 'service_account.json')
10
+ ee.Initialize(credentials)
11
+
12
+ # Gradio dataset
13
  dataset = load_dataset("gradio/NYC-Airbnb-Open-Data", split="train")
14
  df = dataset.to_pandas()
15
 
 
51
  with gr.Blocks() as demo:
52
  with gr.Column():
53
  with gr.Row():
54
+ min_price = gr.Number(value=250, label="Project Name")
55
+ max_price = gr.Number(value=1000, label="Project Description")
56
+ boroughs = gr.CheckboxGroup(choices=["Queens", "Brooklyn", "Manhattan", "Bronx", "Staten Island"], value=["Queens", "Brooklyn"], label="Select Methodology:")
57
  btn = gr.Button(value="Update Filter")
58
+ btn = gr.Button(value="Save")
59
+ btn = gr.Button(value="Run")
60
  map = gr.Plot().style()
61
  demo.load(filter_map, [min_price, max_price, boroughs], map)
62
  btn.click(filter_map, [min_price, max_price, boroughs], map)
requirements.txt CHANGED
@@ -1,3 +1,8 @@
1
  datasets
2
  plotly
3
  gradio
 
 
 
 
 
 
1
  datasets
2
  plotly
3
  gradio
4
+ duckdb==0.8.1
5
+ geemap
6
+ segment-geospatial
7
+ geojson
8
+ yaml