File size: 837 Bytes
b80dfb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import requests

def fetch_firefox_documentation(query):
    url = "https://oevortex-webscout-api.hf.space/api/adv_web_search"
    params = {'q': query}
    headers = {'accept': 'application/json'}
    
    response = requests.get(url, headers=headers, params=params)
    
    if response.status_code == 200:
        data = response.json()
        
        results = data.get('response')
        
        return results  
    else:
        return ["Error: Failed to fetch data"]

# Create a Gradio interface
iface = gr.Interface(
    fn=fetch_firefox_documentation,
    inputs=gr.Textbox(label="Search Query", placeholder="Enter your search query..."),
    outputs=gr.Textbox(label="Response"),
    title="Firefox Documentation Search",
    description="Enter a search query"
)

# Launch the interface
iface.launch()