Spaces:
Running
Running
fix: runtime errors
Browse files- .env.example +1 -1
- src/config.py +0 -1
- src/main.py +8 -5
- src/services/google.py +1 -3
.env.example
CHANGED
@@ -1 +1 @@
|
|
1 |
-
GEMINI_API_KEY=
|
|
|
1 |
+
GEMINI_API_KEY=KEYS
|
src/config.py
CHANGED
@@ -23,7 +23,6 @@ class BaseAppSettings(BaseSettings):
|
|
23 |
|
24 |
|
25 |
class AppSettings(BaseAppSettings):
|
26 |
-
gemini_api_key: SecretStr
|
27 |
gemini_api_keys: SecretStr
|
28 |
# assistant_api_key: SecretStr
|
29 |
top_p: float = 0.95
|
|
|
23 |
|
24 |
|
25 |
class AppSettings(BaseAppSettings):
|
|
|
26 |
gemini_api_keys: SecretStr
|
27 |
# assistant_api_key: SecretStr
|
28 |
top_p: float = 0.95
|
src/main.py
CHANGED
@@ -330,9 +330,7 @@ with gr.Blocks(
|
|
330 |
game_image,
|
331 |
game_choices,
|
332 |
custom_choice,
|
333 |
-
ls_user_hash,
|
334 |
],
|
335 |
-
concurrency_limit=CONCURRENCY_LIMIT,
|
336 |
)
|
337 |
|
338 |
back_btn.click(
|
@@ -345,12 +343,18 @@ with gr.Blocks(
|
|
345 |
error_message,
|
346 |
],
|
347 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
|
349 |
custom_choice.submit(
|
350 |
fn=update_scene,
|
351 |
inputs=[ls_user_hash, custom_choice],
|
352 |
outputs=[game_text, game_image, game_choices, custom_choice],
|
353 |
-
concurrency_limit=CONCURRENCY_LIMIT,
|
354 |
)
|
355 |
|
356 |
demo.unload(cleanup_music_session)
|
@@ -363,9 +367,8 @@ with gr.Blocks(
|
|
363 |
fn=update_audio,
|
364 |
inputs=[ls_user_hash],
|
365 |
outputs=[audio_out],
|
366 |
-
concurrency_limit=CONCURRENCY_LIMIT,
|
367 |
)
|
368 |
|
369 |
|
370 |
-
demo.queue()
|
371 |
demo.launch(ssr_mode=False)
|
|
|
330 |
game_image,
|
331 |
game_choices,
|
332 |
custom_choice,
|
|
|
333 |
],
|
|
|
334 |
)
|
335 |
|
336 |
back_btn.click(
|
|
|
343 |
error_message,
|
344 |
],
|
345 |
)
|
346 |
+
|
347 |
+
game_choices.change(
|
348 |
+
fn=update_scene,
|
349 |
+
inputs=[ls_user_hash, game_choices],
|
350 |
+
outputs=[game_text, game_image, game_choices, custom_choice],
|
351 |
+
concurrency_limit=CONCURRENCY_LIMIT,
|
352 |
+
)
|
353 |
|
354 |
custom_choice.submit(
|
355 |
fn=update_scene,
|
356 |
inputs=[ls_user_hash, custom_choice],
|
357 |
outputs=[game_text, game_image, game_choices, custom_choice],
|
|
|
358 |
)
|
359 |
|
360 |
demo.unload(cleanup_music_session)
|
|
|
367 |
fn=update_audio,
|
368 |
inputs=[ls_user_hash],
|
369 |
outputs=[audio_out],
|
|
|
370 |
)
|
371 |
|
372 |
|
373 |
+
demo.queue(default_concurrency_limit=CONCURRENCY_LIMIT)
|
374 |
demo.launch(ssr_mode=False)
|
src/services/google.py
CHANGED
@@ -19,9 +19,7 @@ class ApiKeyPool:
|
|
19 |
self._sync_lock = threading.Lock()
|
20 |
|
21 |
def _load_keys(self) -> None:
|
22 |
-
keys_raw =
|
23 |
-
getattr(settings, "gemini_api_keys", None) or settings.gemini_api_key
|
24 |
-
)
|
25 |
keys_str = keys_raw.get_secret_value()
|
26 |
keys = [k.strip() for k in keys_str.split(',') if k.strip()] if keys_str else []
|
27 |
if not keys:
|
|
|
19 |
self._sync_lock = threading.Lock()
|
20 |
|
21 |
def _load_keys(self) -> None:
|
22 |
+
keys_raw = settings.gemini_api_keys
|
|
|
|
|
23 |
keys_str = keys_raw.get_secret_value()
|
24 |
keys = [k.strip() for k in keys_str.split(',') if k.strip()] if keys_str else []
|
25 |
if not keys:
|