Satyam-Singh commited on
Commit
6646be1
·
verified ·
1 Parent(s): 7c664e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -1,4 +1,33 @@
 
 
 
 
 
1
  import os
 
 
 
 
 
 
 
 
 
 
 
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- exec(os.environ.get('CODE'))
 
 
1
+ #import os
2
+ #exec(os.environ.get('CODE'))
3
+
4
+
5
+ import gradio as gr
6
  import os
7
+ import google.generativeai as genai
8
+
9
+ def gemini_chat(message, history):
10
+ response = chat.send_message(message)
11
+ return response.text
12
+
13
+ API_KEY = os.getenv('GOOGLE_API_KEY')
14
+ genai.configure(api_key=API_KEY)
15
+
16
+ model = genai.GenerativeModel('gemini-pro')
17
+ chat = model.start_chat()
18
 
19
+ iface = gr.ChatInterface(
20
+ fn=gemini_chat,
21
+ title='Gemini Chat',
22
+ chatbot=gr.Chatbot(height=1000),
23
+ textbox=gr.Textbox(
24
+ placeholder="Message Gemini",
25
+ scale=7
26
+ ),
27
+ retry_btn=None,
28
+ undo_btn=None,
29
+ clear_btn=None
30
+ )
31
 
32
+ if __name__ == '__main__':
33
+ iface.launch()