Spaces:
Sleeping
Sleeping
File size: 948 Bytes
7dfc5f5 ce9f68f 7dfc5f5 87f7c27 7dfc5f5 |
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 |
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)
|