Spaces:
Running

search_tool / app.py
Tarekt's picture
Update app.py
3714c6c verified
Raw History Blame Contribute Delete
1.14 kB
import requests
import json
import gradio as gr
def simulate_thinking_chat(message, history):
response = requests.request("POST", "https://api.langsearch.com/v1/web-search", headers={'Authorization': 'Bearer sk-e94998940aae45a5854c45eade3ec168', 'Content-Type': 'application/json'}, data=json.dumps({ "query": f"{message}", "freshness": "noLimit", "summary": True, "count": 50}))
yield response.text
theme = gr.themes.Base(primary_hue="violet", secondary_hue="violet", neutral_hue="zinc",)
with gr.Blocks() as demo:
gr.ChatInterface(
simulate_thinking_chat,
title="Agentic AI Chat Boot 🤔",
multimodal=False,
chatbot = gr.Chatbot(label="Agent", avatar_images=("https://api.dicebear.com/7.x/avataaars/svg?seed=Felix", "https://em-content.zobj.net/source/twitter/376/hugging-face_1f917.png",),),
textbox= gr.MultimodalTextbox(
interactive=True,
file_count="multiple",
placeholder="Enter message...",
show_label=False),
save_history=False,
editable=True,
fill_width=True,
stop_btn=True,
analytics_enabled=True)
demo.launch(theme=theme, share=True, mcp_server=True)