|
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"] |
|
|
|
|
|
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 |
|
) |
|
|
|
|
|
iface.launch() |
|
|