KingNish's picture
Create app.py
b80dfb3 verified
raw
history blame
837 Bytes
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()