Commit
·
86537bd
1
Parent(s):
b02669d
update app
Browse files
app.py
CHANGED
@@ -17,11 +17,11 @@ with gr.Blocks() as demo:
|
|
17 |
|
18 |
with gr.Row():
|
19 |
query_input = gr.Textbox(label="Search Query", placeholder="e.g. AI trends in 2024")
|
20 |
-
depth_input = gr.Dropdown(label="Search Depth", choices=["standard", "deep"])
|
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,
|
@@ -30,12 +30,11 @@ with gr.Blocks() as demo:
|
|
30 |
)
|
31 |
|
32 |
def enable_submit(q, d, k):
|
33 |
-
return gr.Button.update(interactive=bool(q and d and k)) #
|
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 |
-
|
40 |
-
|
41 |
-
demo.launch()
|
|
|
17 |
|
18 |
with gr.Row():
|
19 |
query_input = gr.Textbox(label="Search Query", placeholder="e.g. AI trends in 2024")
|
20 |
+
depth_input = gr.Dropdown(label="Search Depth", choices=["standard", "deep"], value="standard") # Added default value
|
21 |
api_key_input = gr.Textbox(label="Linkup API Key", type="password")
|
22 |
|
23 |
output = gr.Markdown()
|
24 |
+
btn = gr.Button("Search", interactive=False) # Disabled by default
|
25 |
|
26 |
btn.click(
|
27 |
fn=run_search,
|
|
|
30 |
)
|
31 |
|
32 |
def enable_submit(q, d, k):
|
33 |
+
return gr.Button.update(interactive=bool(q.strip() and d and k.strip())) # Check for non-empty strings
|
34 |
|
35 |
+
# Update button state when any input changes
|
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 |
+
demo.launch()
|
|
|
|