| import gradio as gr |
| from chain import get_feelmate_chain |
|
|
| |
| feelmate_chain = get_feelmate_chain() |
|
|
| def chat_with_feelmate(user_message, history): |
| if history is None: |
| history = [] |
| if not user_message.strip(): |
| return "Please share something with me π¬", history |
| |
| |
| response = feelmate_chain.predict(input=user_message) |
| |
| |
| history.append((user_message, response)) |
| |
| |
| history = history[-10:] |
| |
| return response.strip(), history |
|
|
| |
| iface = gr.Interface( |
| fn=chat_with_feelmate, |
| inputs=[gr.Textbox(lines=3, placeholder="Tell me how you're feeling today..."), gr.State()], |
| outputs=[gr.Textbox(), gr.State()], |
| title="π« FeelMate - Your Emotional Support Buddy", |
| description="No judgment. Just kindness, understanding, and a little light. π", |
| live=True |
| ) |
|
|
| if __name__ == "__main__": |
| iface.launch() |
|
|