Commit
Β·
b17bf8d
1
Parent(s):
d6054c0
update app
Browse files
app.py
CHANGED
@@ -12,14 +12,21 @@ def run_search(query, depth, api_key):
|
|
12 |
except Exception as e:
|
13 |
return f"β Error: {str(e)}"
|
14 |
|
15 |
-
def enable_submit(q, d, k):
|
16 |
-
|
17 |
|
18 |
def load_readme():
|
19 |
path = Path(__file__).parent / "README.md"
|
20 |
if path.exists():
|
21 |
return path.read_text()
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
25 |
gr.Markdown(
|
@@ -52,7 +59,7 @@ with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
|
52 |
type="password",
|
53 |
)
|
54 |
|
55 |
-
search_btn = gr.Button("π Search", interactive=
|
56 |
output = gr.Markdown("π¬ *Enter a query and click Search to begin.*", elem_id="output")
|
57 |
|
58 |
search_btn.click(
|
@@ -62,9 +69,9 @@ with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
|
62 |
show_progress=True,
|
63 |
)
|
64 |
|
65 |
-
query_input.input(
|
66 |
-
depth_input.input(
|
67 |
-
api_key_input.input(
|
68 |
|
69 |
gr.Markdown("---")
|
70 |
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"
|
20 |
if path.exists():
|
21 |
return path.read_text()
|
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
|
29 |
+
return "\n".join(lines)
|
30 |
|
31 |
with gr.Blocks(title="Linkup Web Search Tool") as demo:
|
32 |
gr.Markdown(
|
|
|
59 |
type="password",
|
60 |
)
|
61 |
|
62 |
+
search_btn = gr.Button("π Search", interactive=True)
|
63 |
output = gr.Markdown("π¬ *Enter a query and click Search to begin.*", elem_id="output")
|
64 |
|
65 |
search_btn.click(
|
|
|
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")
|