random-123 / app.py
deekshitha11's picture
Update app.py
1597306 verified
raw
history blame contribute delete
769 Bytes
import gradio as gr
import google.generativeai as genai
import os
# πŸ” API KEY (replace with your own OR use HF secrets)
genai.configure(api_key="AIzaSyCv41YJ6j_Iag1Lf9RrFeOBdeS5gOedmz8")
# ⚑ Model (stable working one)
model = genai.GenerativeModel("gemini-1.5-flash")
def chat(message, history):
try:
response = model.generate_content(
"You are a kind, supportive mental health assistant. "
"Reply calmly and helpfully.\n\nUser: " + message
)
return response.text
except:
return "I'm here for you πŸ’™ Please tell me more."
# πŸ’¬ Gradio Chat UI
demo = gr.ChatInterface(
fn=chat,
title="πŸ’™ Mental Health Support Bot",
description="A safe space to talk anytime πŸ’™"
)
demo.launch()