Spaces:
Running
Running
Download app.py from Tarekt/search_tool: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/Tarekt/search_tool/resolve/main/app.py
- Command line
-
hf download hf://spaces/Tarekt/search_tool/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Tarekt/search_tool/resolve/main/app.py
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) |