benchang323 commited on
Commit
b228632
·
verified ·
1 Parent(s): 03a4fde

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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
- return f"✅ Query added under category '{category}'!"
 
 
 
 
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:")