| | |
| | import streamlit as st |
| | import requests |
| |
|
| | |
| | API_URL = "https://Yuki-Chen-emochatbot.hf.space/dialogflow" |
| |
|
| | |
| | st.set_page_config(page_title="Lumi - I'm here for you", layout="centered") |
| |
|
| | |
| | st.title("β¨ Meet Lumi - Your Companion π") |
| | st.markdown("π¬ *You're not alone. Lumi is here to listen and support you.*") |
| |
|
| | |
| | user_input = st.text_area("π Talk to Lumi:", placeholder="Tell Lumi how you're feeling today...") |
| |
|
| | |
| | def get_emotion(text): |
| | payload = { |
| | "queryResult": {"queryText": text}, |
| | "session": "test_session_123" |
| | } |
| | response = requests.post(API_URL, json=payload) |
| | |
| | if response.status_code == 200: |
| | return response.json().get("fulfillmentText", "Lumi is here for you. Take your time. π") |
| | else: |
| | return "β οΈ API Error: Something went wrong. But Lumi is still here for you." |
| |
|
| | |
| | if st.button("π‘ Share with Lumi"): |
| | if user_input: |
| | result = get_emotion(user_input) |
| | st.success(result) |
| | else: |
| | st.warning("π¬ Go ahead, share your thoughts with Lumi. Lumi is listening. π") |
| |
|
| | |
| | st.markdown("---") |
| | st.markdown("β¨ **Lumi is always here whenever you need someone to talk to.** π") |
| |
|