AbuAlone09 commited on
Commit
1c06a35
·
verified ·
1 Parent(s): b5a6ce7

Update backend_api.py

Browse files
Files changed (1) hide show
  1. backend_api.py +3 -7
backend_api.py CHANGED
@@ -89,15 +89,11 @@ import threading
89
  _client_pool = {}
90
  _client_pool_lock = threading.Lock()
91
 
92
- # Cấu hình API Key của Google
93
- genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
94
 
95
  # Hàm này thay thế cho việc gọi get_inference_client
96
- def get_gemini_model():
97
- # Gemini 1.5 Flash cực kỳ mạnh và hỗ trợ context window khổng lồ
98
- # Bạn sẽ không bao giờ gặp lỗi 413 "Request too large" nữa
99
- return genai.GenerativeModel("gemini-1.5-flash")
100
-
101
 
102
  # Define models and languages here to avoid importing Gradio UI
103
  AVAILABLE_MODELS = [
 
89
  _client_pool = {}
90
  _client_pool_lock = threading.Lock()
91
 
92
+ client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
 
93
 
94
  # Hàm này thay thế cho việc gọi get_inference_client
95
+ def get_genai_client():
96
+ return client
 
 
 
97
 
98
  # Define models and languages here to avoid importing Gradio UI
99
  AVAILABLE_MODELS = [