File size: 967 Bytes
b80dfb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610e879
b80dfb3
 
 
 
 
 
 
610e879
72391b1
610e879
 
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
32
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, 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.Markdown(label="Response"),gr.Textbox(label="Response", visible=False)],
    title="Search Tool for Hf Chat",
    description="You can try it from here. https://hf.co/chat/tools/66eaa0f93d0af6e84bc3c447",
    concurrency_limit=10
)

# Launch the interface
iface.launch()