rairo commited on
Commit
1d2bbdd
·
verified ·
1 Parent(s): 59e36e4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -5
main.py CHANGED
@@ -193,14 +193,15 @@ def process_with_gemini(model, text):
193
  ]
194
  }"""
195
  try:
196
- resp = model.generate_content([prompt, text])
 
197
  time.sleep(6) # match your Streamlit rate-limit workaround
198
  return resp.text
199
  except Exception as e:
200
  # retry once on 504
201
  if hasattr(e, "response") and getattr(e.response, "status_code", None) == 504:
202
  time.sleep(6)
203
- resp = model.generate_content([prompt, text])
204
  return resp.text
205
  raise
206
 
@@ -262,9 +263,6 @@ def upload_statements():
262
  if not files:
263
  return jsonify({"error": "No files uploaded"}), 400
264
 
265
- # configure exactly as in your Streamlit code
266
- model = genai.GenerativeModel("gemini-2.0-flash-thinking-exp")
267
- stored_count = 0
268
 
269
  for f in files:
270
  filename = f.filename or "statement.pdf"
 
193
  ]
194
  }"""
195
  try:
196
+
197
+ resp = client.models.generate_content(model='gemini-2.0-flash-exp', contents=[prompt, text])
198
  time.sleep(6) # match your Streamlit rate-limit workaround
199
  return resp.text
200
  except Exception as e:
201
  # retry once on 504
202
  if hasattr(e, "response") and getattr(e.response, "status_code", None) == 504:
203
  time.sleep(6)
204
+ resp = client.models.generate_content(model='gemini-2.0-flash-exp', [prompt, text])
205
  return resp.text
206
  raise
207
 
 
263
  if not files:
264
  return jsonify({"error": "No files uploaded"}), 400
265
 
 
 
 
266
 
267
  for f in files:
268
  filename = f.filename or "statement.pdf"