KingNish commited on
Commit
b80dfb3
·
verified ·
1 Parent(s): 591d17b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ def fetch_firefox_documentation(query):
5
+ url = "https://oevortex-webscout-api.hf.space/api/adv_web_search"
6
+ params = {'q': query}
7
+ headers = {'accept': 'application/json'}
8
+
9
+ response = requests.get(url, headers=headers, params=params)
10
+
11
+ if response.status_code == 200:
12
+ data = response.json()
13
+
14
+ results = data.get('response')
15
+
16
+ return results
17
+ else:
18
+ return ["Error: Failed to fetch data"]
19
+
20
+ # Create a Gradio interface
21
+ iface = gr.Interface(
22
+ fn=fetch_firefox_documentation,
23
+ inputs=gr.Textbox(label="Search Query", placeholder="Enter your search query..."),
24
+ outputs=gr.Textbox(label="Response"),
25
+ title="Firefox Documentation Search",
26
+ description="Enter a search query"
27
+ )
28
+
29
+ # Launch the interface
30
+ iface.launch()