Spaces:
Running
Running
add metadata
Browse files- app.py +2 -5
- data/whisp_columns.xlsx +0 -0
- utils/whisp_preprocessing.py +9 -6
app.py
CHANGED
@@ -11,11 +11,8 @@ with gr.Blocks() as ui:
|
|
11 |
file_input = gr.File(file_types=[".geojson"])
|
12 |
submit_btn = gr.Button("Submit")
|
13 |
with gr.Column():
|
14 |
-
output = gr.
|
15 |
-
|
16 |
-
# Second row for additional outputs
|
17 |
-
#with gr.Row():
|
18 |
-
# statistics_output = gr.Dataframe(label="Statistics Summary")
|
19 |
|
20 |
# Submit button action
|
21 |
submit_btn.click(get_statistics,
|
|
|
11 |
file_input = gr.File(file_types=[".geojson"])
|
12 |
submit_btn = gr.Button("Submit")
|
13 |
with gr.Column():
|
14 |
+
output = gr.Dataframe()
|
15 |
+
|
|
|
|
|
|
|
16 |
|
17 |
# Submit button action
|
18 |
submit_btn.click(get_statistics,
|
data/whisp_columns.xlsx
ADDED
Binary file (22.7 kB). View file
|
|
utils/whisp_preprocessing.py
CHANGED
@@ -3,14 +3,17 @@ import openpyxl
|
|
3 |
|
4 |
def preprocess_whisp_data(response):
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
#
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
-
return
|
14 |
|
15 |
|
16 |
|
|
|
3 |
|
4 |
def preprocess_whisp_data(response):
|
5 |
|
6 |
+
# Retrieve response
|
7 |
+
whisp_response = pd.DataFrame(response['properties'])
|
8 |
+
whisp_response = whisp_response.melt(var_name="Column", value_name="Value")
|
9 |
|
10 |
+
# Load metadata
|
11 |
+
whisp_metadata = pd.read_excel('././data/whisp_columns.xlsx')
|
12 |
+
|
13 |
+
# Merge datasets
|
14 |
+
full_df = pd.DataFrame(whisp_response).merge(whisp_metadata, left_on="Column", right_on="Column name").drop(columns={"Column name"})
|
15 |
|
16 |
+
return full_df
|
17 |
|
18 |
|
19 |
|