Spaces:
Paused
Paused
Update backend_api.py
Browse files- 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 |
-
|
| 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
|
| 97 |
-
|
| 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 = [
|