File size: 708 Bytes
816a73b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from workflow import get_workflow
from query import preprocess_query

# Initialize the workflow
chat_chain = get_workflow()

def chatbot_function(user_input):
    """Handle user input for chatbot conversation and weather queries."""
    processed_input = preprocess_query(user_input)
    return processed_input

# Create a Gradio interface for the chatbot
iface = gr.Interface(fn=chatbot_function, 
                     inputs="text", 
                     outputs="text",
                     title="Streaming Chatbot with Weather Queries",
                     description="Ask the bot about the weather or have a conversation.")

# Launch the Gradio interface
iface.launch(share=True)