zealous79A commited on
Commit
057ae12
·
verified ·
1 Parent(s): 98ed10b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -69,18 +69,22 @@ def load_new_dataset():
69
  gr.Info(message="Loading dataset...")
70
  ds = load_dataset("fka/awesome-chatgpt-prompts", split="train")
71
 
 
 
 
 
72
  #----------------------
73
 
74
  with gr.Blocks() as demo:
75
  text_input = gr.Textbox(visible=True, label="Query")
76
  btn_run = gr.Button(visible=True, value="Search")
77
  results_output = gr.Dataframe(label="Results", visible=True, wrap=True)
78
-
 
79
  btn_run.click(
80
- #fn=run_query,
81
- #inputs=[text_input, query_input, split_dropdown, column_dropdown],
82
- #outputs=results_output,
83
- print("button pressed!")
84
  )
85
 
86
  #----------------------
 
69
  gr.Info(message="Loading dataset...")
70
  ds = load_dataset("fka/awesome-chatgpt-prompts", split="train")
71
 
72
+ def run_query(query):
73
+ # Placeholder function to simulate a query
74
+ return {"Result": f"Results for '{query}'"}
75
+
76
  #----------------------
77
 
78
  with gr.Blocks() as demo:
79
  text_input = gr.Textbox(visible=True, label="Query")
80
  btn_run = gr.Button(visible=True, value="Search")
81
  results_output = gr.Dataframe(label="Results", visible=True, wrap=True)
82
+ logging_output = gr.Label(visible="True", value="My first logging message")
83
+
84
  btn_run.click(
85
+ fn=lambda query: (run_query(query), "Button pressed!"), # Call the run_query function and update the label
86
+ inputs=text_input,
87
+ outputs=[results_output, logging_output] # Update both the DataFrame and the label
 
88
  )
89
 
90
  #----------------------