ahmadmac commited on
Commit
447dc25
·
verified ·
1 Parent(s): 62d4c8f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import google.generativeai as genai
2
+ import gradio as gr
3
+ import os
4
+
5
+ GOOGLE_API_KEY=os.get('GOOGLE_API_KEY')
6
+ genai.configure(api_key=GOOGLE_API_KEY)
7
+
8
+ model = genai.GenerativeModel('gemini-1.5-flash')
9
+
10
+ def chatbot(messages,history):
11
+ user_message = messages[-1]['content']
12
+ response = model.generate_content(user_message)
13
+ return response.text
14
+
15
+ chatbot_interface = gr.ChatInterface(
16
+ fn=chatbot,
17
+ title="Gemini Conversational Chatbot",
18
+ description="Chat with a conversational AI model powered by Gemini.",
19
+ )
20
+
21
+
22
+ chatbot_interface.launch()