from langchain_google_genai import ChatGoogleGenerativeAI from dotenv import load_dotenv import gradio as gr import os # Load API key from .env load_dotenv() api_key = os.getenv("GOOGLE_API_KEY") model = "gemini-2.5-flash" # Initialize the model llm = ChatGoogleGenerativeAI(model=model, api_key=api_key) # Chat function for Gradio def chat_with_bot(message, history): response = llm.invoke(message) return response.content # Gradio Chat Interface gr.ChatInterface(fn=chat_with_bot, title="Gemini Chatbot").launch()