Spaces:
Running
Running
Commit
·
48ed8f4
1
Parent(s):
03301f1
Add application files
Browse files
app.py
CHANGED
@@ -70,11 +70,11 @@ def greet(name1, name2):
|
|
70 |
# Convert the key-value pairs into a table format (a list of lists)
|
71 |
df_pred = pd.DataFrame(key_value_pairs, columns = ["Ontology Attribute", "Value"]).iloc[:19,:]
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
return html_output, csv_output
|
79 |
# return df_pred.to_html()
|
80 |
|
@@ -104,7 +104,7 @@ iface = gr.Interface(fn=greet,
|
|
104 |
inputs=input_boxes,
|
105 |
outputs=[
|
106 |
gr.outputs.HTML(label="Output Table"),
|
107 |
-
gr.outputs.File(label="Download Output as CSV"
|
108 |
],
|
109 |
|
110 |
examples=[ # Sample text examples
|
|
|
70 |
# Convert the key-value pairs into a table format (a list of lists)
|
71 |
df_pred = pd.DataFrame(key_value_pairs, columns = ["Ontology Attribute", "Value"]).iloc[:19,:]
|
72 |
|
73 |
+
# Save the CSV data to a temporary file
|
74 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".csv") as temp_file:
|
75 |
+
output.to_csv(temp_file.name, index=False)
|
76 |
+
csv_output = temp_file.name
|
77 |
+
|
78 |
return html_output, csv_output
|
79 |
# return df_pred.to_html()
|
80 |
|
|
|
104 |
inputs=input_boxes,
|
105 |
outputs=[
|
106 |
gr.outputs.HTML(label="Output Table"),
|
107 |
+
gr.outputs.File(label="Download Output as CSV")
|
108 |
],
|
109 |
|
110 |
examples=[ # Sample text examples
|