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()