Commit
Β·
43d44da
1
Parent(s):
b17bf8d
update app
Browse files
app.py
CHANGED
@@ -12,8 +12,8 @@ def run_search(query, depth, api_key):
|
|
12 |
except Exception as e:
|
13 |
return f"β Error: {str(e)}"
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
def load_readme():
|
19 |
path = Path(__file__).parent / "README.md"
|
@@ -22,7 +22,6 @@ def load_readme():
|
|
22 |
|
23 |
lines = path.read_text().splitlines()
|
24 |
if lines[0].strip() == "---":
|
25 |
-
# Find the closing "---"
|
26 |
end_index = next((i for i, line in enumerate(lines[1:], 1) if line.strip() == "---"), -1)
|
27 |
if end_index != -1:
|
28 |
lines = lines[end_index + 1:] # Skip frontmatter
|
@@ -33,10 +32,6 @@ with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
|
33 |
"""
|
34 |
# π Linkup Web Search Tool
|
35 |
Perform real-time web search using [Linkup API](https://linkup.so).
|
36 |
-
|
37 |
-
π§ Supports `standard` and `deep` query depth.
|
38 |
-
π Requires your personal Linkup API key.
|
39 |
-
π‘ Ideal for facts, trends, research, and real-time data discovery.
|
40 |
""",
|
41 |
elem_id="header",
|
42 |
)
|
@@ -69,9 +64,9 @@ with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
|
69 |
show_progress=True,
|
70 |
)
|
71 |
|
72 |
-
query_input.input([query_input, depth_input, api_key_input], [search_btn])
|
73 |
-
depth_input.input([query_input, depth_input, api_key_input], [search_btn])
|
74 |
-
api_key_input.input([query_input, depth_input, api_key_input], [search_btn])
|
75 |
|
76 |
gr.Markdown("---")
|
77 |
gr.Markdown("## π Tool Documentation")
|
|
|
12 |
except Exception as e:
|
13 |
return f"β Error: {str(e)}"
|
14 |
|
15 |
+
def enable_submit(q, d, k):
|
16 |
+
return gr.Button.update(interactive=bool(q.strip() and d and k.strip()))
|
17 |
|
18 |
def load_readme():
|
19 |
path = Path(__file__).parent / "README.md"
|
|
|
22 |
|
23 |
lines = path.read_text().splitlines()
|
24 |
if lines[0].strip() == "---":
|
|
|
25 |
end_index = next((i for i, line in enumerate(lines[1:], 1) if line.strip() == "---"), -1)
|
26 |
if end_index != -1:
|
27 |
lines = lines[end_index + 1:] # Skip frontmatter
|
|
|
32 |
"""
|
33 |
# π Linkup Web Search Tool
|
34 |
Perform real-time web search using [Linkup API](https://linkup.so).
|
|
|
|
|
|
|
|
|
35 |
""",
|
36 |
elem_id="header",
|
37 |
)
|
|
|
64 |
show_progress=True,
|
65 |
)
|
66 |
|
67 |
+
query_input.input(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
|
68 |
+
depth_input.input(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
|
69 |
+
api_key_input.input(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
|
70 |
|
71 |
gr.Markdown("---")
|
72 |
gr.Markdown("## π Tool Documentation")
|