Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
import os
|
3 |
+
import gradio as gr
|
4 |
+
from pipeline import run_with_chain
|
5 |
+
|
6 |
+
def ask_dailywellness(query: str) -> str:
|
7 |
+
"""
|
8 |
+
Calls our main pipeline function from pipeline.py
|
9 |
+
"""
|
10 |
+
return run_with_chain(query)
|
11 |
+
|
12 |
+
# Build a simple Gradio interface
|
13 |
+
interface = gr.Interface(
|
14 |
+
fn=ask_dailywellness,
|
15 |
+
inputs=gr.Textbox(
|
16 |
+
lines=2,
|
17 |
+
label="Ask DailyWellnessAI",
|
18 |
+
placeholder="e.g., How do I improve my posture while working?"
|
19 |
+
),
|
20 |
+
outputs=gr.Textbox(
|
21 |
+
label="DailyWellnessAI Answer"
|
22 |
+
),
|
23 |
+
title="DailyWellnessAI Chat",
|
24 |
+
description=(
|
25 |
+
"Ask a wellness question, or something about DailyWellnessAI (brand). "
|
26 |
+
"If the question is out of scope, you'll get a polite refusal."
|
27 |
+
),
|
28 |
+
allow_flagging="never"
|
29 |
+
)
|
30 |
+
|
31 |
+
if __name__ == "__main__":
|
32 |
+
interface.launch(server_name="0.0.0.0", server_port=7860)
|