nischaypar commited on
Commit
b17bf8d
Β·
1 Parent(s): d6054c0

update app

Browse files
Files changed (1) hide show
  1. app.py +14 -7
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
- 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
- return "README.md not found."
 
 
 
 
 
 
 
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=False)
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(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
66
- depth_input.input(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
67
- api_key_input.input(enable_submit, [query_input, depth_input, api_key_input], [search_btn])
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")