File size: 1,709 Bytes
bf5275b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f71ec9b
 
 
 
 
 
 
 
 
 
bf5275b
 
 
 
f71ec9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bf5275b
 
 
f71ec9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import gradio as gr
from dotenv import load_dotenv
from smolagents import CodeAgent, HfApiModel

# Load environment variables
load_dotenv()

# Get API token and model settings from environment variables
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



# Chat history to maintain conversation context
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

# Create Gradio interface
# demo = gr.ChatInterface(
#     fn=relavant_info,
#     title="Smol-Agent Chatbot",
#     description="Ask me anything!",
#     examples=[
#         "What is machine learning?",
#         "How does a transformer model work?",
#         "Explain quantum computing in simple terms"
#     ],
#     theme=gr.themes.Soft()
# )
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)

# Launch the app
if __name__ == "__main__":
    ui.launch(mcp_server=True)