Anmol3263 commited on
Commit
4765392
·
verified ·
1 Parent(s): 8eb4936

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -2,15 +2,11 @@ import gradio as gr
2
  import google.generativeai as genai
3
  import os
4
 
5
- # API KEY
6
  API_KEY = os.getenv("GEMINI_API_KEY")
7
 
8
- if not API_KEY:
9
- raise Exception("API KEY missing")
10
-
11
  genai.configure(api_key=API_KEY)
12
 
13
- model = genai.GenerativeModel("gemini-1.5-flash")
14
 
15
  def chat(message, history):
16
  try:
@@ -24,10 +20,6 @@ def chat(message, history):
24
  except Exception as e:
25
  return f"Error: {str(e)}"
26
 
27
-
28
- demo = gr.ChatInterface(
29
- fn=chat,
30
- type="messages" # 👈 IMPORTANT FIX
31
- )
32
 
33
  demo.launch()
 
2
  import google.generativeai as genai
3
  import os
4
 
 
5
  API_KEY = os.getenv("GEMINI_API_KEY")
6
 
 
 
 
7
  genai.configure(api_key=API_KEY)
8
 
9
+ model = genai.GenerativeModel("gemini-1.0-pro") # ✅ FIXED
10
 
11
  def chat(message, history):
12
  try:
 
20
  except Exception as e:
21
  return f"Error: {str(e)}"
22
 
23
+ demo = gr.ChatInterface(fn=chat, type="messages")
 
 
 
 
24
 
25
  demo.launch()