Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,11 @@ def add_query(category, query, positive1, positive2, negative1, negative2):
|
|
| 36 |
with open(DATA_FILE, "w") as file:
|
| 37 |
json.dump(data, file, indent=4)
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# Function to prepare the JSON file for download
|
| 42 |
def prepare_download():
|
|
@@ -60,7 +64,7 @@ with gr.Blocks() as app:
|
|
| 60 |
submit_button.click(
|
| 61 |
add_query,
|
| 62 |
inputs=[category_input, query_input, positive1_input, positive2_input, negative1_input, negative2_input],
|
| 63 |
-
outputs=status_output
|
| 64 |
)
|
| 65 |
|
| 66 |
gr.Markdown("### Download Stored Queries:")
|
|
|
|
| 36 |
with open(DATA_FILE, "w") as file:
|
| 37 |
json.dump(data, file, indent=4)
|
| 38 |
|
| 39 |
+
# Return success message and clear all inputs
|
| 40 |
+
return (
|
| 41 |
+
f"✅ Query added under category '{category}'!",
|
| 42 |
+
"", "", "", "", "", "" # Clearing all input fields
|
| 43 |
+
)
|
| 44 |
|
| 45 |
# Function to prepare the JSON file for download
|
| 46 |
def prepare_download():
|
|
|
|
| 64 |
submit_button.click(
|
| 65 |
add_query,
|
| 66 |
inputs=[category_input, query_input, positive1_input, positive2_input, negative1_input, negative2_input],
|
| 67 |
+
outputs=[status_output, category_input, query_input, positive1_input, positive2_input, negative1_input, negative2_input] # Clears inputs
|
| 68 |
)
|
| 69 |
|
| 70 |
gr.Markdown("### Download Stored Queries:")
|