nischaypar commited on
Commit
b02669d
·
1 Parent(s): 2a05c69

update app

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from tool import LinkupSearchTool
3
 
4
- tool = LinkupSearchTool() # we will pass API key at runtime only
5
 
6
  def run_search(query, depth, api_key):
7
  if not query or not depth or not api_key:
@@ -21,7 +21,7 @@ with gr.Blocks() as demo:
21
  api_key_input = gr.Textbox(label="Linkup API Key", type="password")
22
 
23
  output = gr.Markdown()
24
- btn = gr.Button("Search")
25
 
26
  btn.click(
27
  fn=run_search,
@@ -29,14 +29,13 @@ with gr.Blocks() as demo:
29
  outputs=output
30
  )
31
 
32
- # Disable button unless all fields are filled
33
  def enable_submit(q, d, k):
34
- return bool(q and d and k)
35
 
36
  query_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
37
  depth_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
38
  api_key_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
39
 
40
- btn.interactive = False # disabled by default
41
 
42
  demo.launch()
 
1
  import gradio as gr
2
  from tool import LinkupSearchTool
3
 
4
+ tool = LinkupSearchTool()
5
 
6
  def run_search(query, depth, api_key):
7
  if not query or not depth or not api_key:
 
21
  api_key_input = gr.Textbox(label="Linkup API Key", type="password")
22
 
23
  output = gr.Markdown()
24
+ btn = gr.Button("Search") # ✅ Keep the label here
25
 
26
  btn.click(
27
  fn=run_search,
 
29
  outputs=output
30
  )
31
 
 
32
  def enable_submit(q, d, k):
33
+ return gr.Button.update(interactive=bool(q and d and k)) # ✅ fix
34
 
35
  query_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
36
  depth_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
37
  api_key_input.change(enable_submit, [query_input, depth_input, api_key_input], [btn])
38
 
39
+ btn.interactive = False # Disabled by default
40
 
41
  demo.launch()