|
import os |
|
import gradio as gr |
|
from dotenv import load_dotenv |
|
from smolagents import CodeAgent, HfApiModel |
|
|
|
|
|
load_dotenv() |
|
|
|
|
|
hf_api_token = os.getenv("HF_API_TOKEN") |
|
model_name = os.getenv("MODEL_NAME", "meta-llama/Llama-3.3-70B-Instruct") |
|
max_new_tokens = int(os.getenv("MAX_NEW_TOKENS", 500)) |
|
temperature = float(os.getenv("TEMPERATURE", 0.7)) |
|
from chatbot import agent |
|
|
|
|
|
|
|
|
|
def relavant_info(message, history): |
|
""" |
|
Relevant information for the user |
|
Args: |
|
message (str): The input text to search through |
|
letter (str): The letter to search for |
|
|
|
Returns: |
|
str: The relevant information extracted from the message |
|
""" |
|
response = agent.run(message) |
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui: |
|
gr.Markdown("# Deep Research") |
|
query_textbox = gr.Textbox(label="What topic would you like to research?") |
|
run_button = gr.Button("Run", variant="primary") |
|
report = gr.Markdown(label="Report") |
|
|
|
run_button.click(fn=relavant_info, inputs=query_textbox, outputs=report) |
|
query_textbox.submit(fn=relavant_info, inputs=query_textbox, outputs=report) |
|
|
|
|
|
if __name__ == "__main__": |
|
ui.launch(mcp_server=True) |