Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ Core Support Areas (Scope You *Do* Cover):
|
|
| 84 |
- Offer encouragement when users feel overwhelmed, bloated, or inconsistent.
|
| 85 |
Final Boundary Rule:
|
| 86 |
--------------------
|
| 87 |
-
🔒 Strictly decline all unrelated questions. Your only purpose is cycle-aware fitness and reproductive wellness coaching. Do not give general medical, tech,
|
| 88 |
"""
|
| 89 |
def respond(message, history):
|
| 90 |
messages = [{"role": "system", "content": cycle_ai_prompt}]
|
|
@@ -102,77 +102,13 @@ def respond(message, history):
|
|
| 102 |
)
|
| 103 |
return response['choices'][0]['message']['content'].strip()
|
| 104 |
def custom_chat_ui():
|
| 105 |
-
with gr.Blocks(
|
| 106 |
-
body {
|
| 107 |
-
background-color: #fff6f9;
|
| 108 |
-
}
|
| 109 |
-
.gradio-container {
|
| 110 |
-
font-family: 'Helvetica Neue', sans-serif;
|
| 111 |
-
background-color: #fff6f9;
|
| 112 |
-
}
|
| 113 |
-
.gr-button {
|
| 114 |
-
background-color: #ff8fa0 !important;
|
| 115 |
-
color: white !important;
|
| 116 |
-
border: none !important;
|
| 117 |
-
font-weight: bold;
|
| 118 |
-
border-radius: 8px !important;
|
| 119 |
-
padding: 8px 16px !important;
|
| 120 |
-
}
|
| 121 |
-
.gr-button:hover {
|
| 122 |
-
background-color: #ffa7b4 !important;
|
| 123 |
-
}
|
| 124 |
-
.gr-chatbot {
|
| 125 |
-
background-color: #facda0 !important;
|
| 126 |
-
border-radius: 16px !important;
|
| 127 |
-
padding: 12px;
|
| 128 |
-
}
|
| 129 |
-
.gr-chatbot-message {
|
| 130 |
-
background-color: #fff;
|
| 131 |
-
border: 2px solid #ffb972;
|
| 132 |
-
border-radius: 12px;
|
| 133 |
-
padding: 10px;
|
| 134 |
-
margin: 6px 0;
|
| 135 |
-
}
|
| 136 |
-
.gr-textbox {
|
| 137 |
-
border: 2px solid #ffb972 !important;
|
| 138 |
-
border-radius: 10px !important;
|
| 139 |
-
}
|
| 140 |
-
""") as demo:
|
| 141 |
gr.Image(
|
| 142 |
-
value="",
|
| 143 |
show_label=False,
|
| 144 |
show_share_button=False,
|
| 145 |
-
show_download_button=False
|
| 146 |
-
height=150
|
| 147 |
)
|
| 148 |
-
|
| 149 |
-
gr.Markdown(
|
| 150 |
-
"## 🌺 Welcome to Cycle Coach\nAsk about workouts, birth control, or hormone phases!"
|
| 151 |
-
)
|
| 152 |
-
|
| 153 |
-
chatbot = gr.Chatbot(label="Cycle-Aware Chat", height=400)
|
| 154 |
-
user_input = gr.Textbox(
|
| 155 |
-
placeholder="Ask about workouts, your cycle, or contraceptive health...",
|
| 156 |
-
label="Your Question"
|
| 157 |
-
)
|
| 158 |
-
|
| 159 |
-
with gr.Row():
|
| 160 |
-
example1 = gr.Button("💪 Best workout during my period?")
|
| 161 |
-
example2 = gr.Button("🧠 How does birth control affect strength?")
|
| 162 |
-
|
| 163 |
-
send_btn = gr.Button("💬 Send")
|
| 164 |
-
|
| 165 |
-
def submit_message(message, history):
|
| 166 |
-
response = respond(message, history)
|
| 167 |
-
history = history + [(message, response)]
|
| 168 |
-
return history, ""
|
| 169 |
-
|
| 170 |
-
send_btn.click(submit_message, [user_input, chatbot], [chatbot, user_input])
|
| 171 |
-
user_input.submit(submit_message, [user_input, chatbot], [chatbot, user_input])
|
| 172 |
-
|
| 173 |
-
# Button behavior to insert predefined questions
|
| 174 |
-
example1.click(lambda: ("What's the best workout during my period?", []), outputs=[user_input, chatbot])
|
| 175 |
-
example2.click(lambda: ("How does birth control affect strength?", []), outputs=[user_input, chatbot])
|
| 176 |
-
|
| 177 |
return demo
|
| 178 |
custom_chat_ui().launch()
|
|
|
|
| 84 |
- Offer encouragement when users feel overwhelmed, bloated, or inconsistent.
|
| 85 |
Final Boundary Rule:
|
| 86 |
--------------------
|
| 87 |
+
🔒 Strictly decline all unrelated questions. Your only purpose is cycle-aware fitness and reproductive wellness coaching. Do not give general medical, tech, legal, or life advice.you can still give advice relating to helping symptoms like are homeremeides. no actual medical adivce but recipes are fine
|
| 88 |
"""
|
| 89 |
def respond(message, history):
|
| 90 |
messages = [{"role": "system", "content": cycle_ai_prompt}]
|
|
|
|
| 102 |
)
|
| 103 |
return response['choices'][0]['message']['content'].strip()
|
| 104 |
def custom_chat_ui():
|
| 105 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
gr.Image(
|
| 107 |
+
value="pitbull.jpg",
|
| 108 |
show_label=False,
|
| 109 |
show_share_button=False,
|
| 110 |
+
show_download_button=False
|
|
|
|
| 111 |
)
|
| 112 |
+
gr.ChatInterface(respond)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
return demo
|
| 114 |
custom_chat_ui().launch()
|