Phoenix21's picture
Update app.py
7dfc5f5 verified
raw
history blame
948 Bytes
import gradio as gr
from pipeline import run_with_chain # Import the updated pipeline function
# Define a function that connects the Gradio interface to the pipeline
def ask_dailywellness(query: str) -> str:
try:
# Call the run_with_chain function that processes the query
response = run_with_chain(query)
return response
except Exception as e:
return f"Error processing your request: {str(e)}"
# Define the Gradio interface
interface = gr.Interface(
fn=ask_dailywellness,
inputs=gr.Textbox(lines=2, label="Ask DailyWellnessAI"),
outputs=gr.Textbox(label="DailyWellnessAI Answer"),
title="DailyWellnessAI",
description="Ask about wellness or DailyWellnessAI brand. Out-of-scope queries will be redirected with relevant information."
)
if __name__ == "__main__":
# Launch the Gradio interface with a server
interface.launch(server_name="0.0.0.0", server_port=7860, share=True)