Spaces:
Running
on
Zero
Running
on
Zero
jenbenarye
commited on
Commit
·
a287222
1
Parent(s):
5cafd31
fix initializ_app bug
Browse files- app/app.py +8 -3
app/app.py
CHANGED
@@ -1252,13 +1252,18 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
1252 |
outputs=[conversation_id],
|
1253 |
)
|
1254 |
|
1255 |
-
def
|
|
|
1256 |
global LANGUAGES
|
1257 |
LANGUAGES = load_languages()
|
1258 |
language_choices = list(LANGUAGES.keys())
|
1259 |
default_language = language_choices[0] if language_choices else "English"
|
1260 |
|
1261 |
-
|
|
|
|
|
|
|
|
|
1262 |
|
1263 |
def toggle_admin_panel(visible):
|
1264 |
return gr.Accordion(visible=not visible)
|
@@ -1269,7 +1274,7 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
1269 |
return update_leaderboard_html(updated_data), updated_data
|
1270 |
|
1271 |
demo.load(
|
1272 |
-
fn=
|
1273 |
inputs=None,
|
1274 |
outputs=[
|
1275 |
session_id,
|
|
|
1252 |
outputs=[conversation_id],
|
1253 |
)
|
1254 |
|
1255 |
+
def initialize_app():
|
1256 |
+
"""Initialize the app with session ID, language, and leaderboard data"""
|
1257 |
global LANGUAGES
|
1258 |
LANGUAGES = load_languages()
|
1259 |
language_choices = list(LANGUAGES.keys())
|
1260 |
default_language = language_choices[0] if language_choices else "English"
|
1261 |
|
1262 |
+
# Load initial leaderboard data
|
1263 |
+
leaderboard = load_initial_language_data()
|
1264 |
+
|
1265 |
+
# Return exactly 3 values as expected
|
1266 |
+
return str(uuid.uuid4()), default_language, leaderboard
|
1267 |
|
1268 |
def toggle_admin_panel(visible):
|
1269 |
return gr.Accordion(visible=not visible)
|
|
|
1274 |
return update_leaderboard_html(updated_data), updated_data
|
1275 |
|
1276 |
demo.load(
|
1277 |
+
fn=initialize_app,
|
1278 |
inputs=None,
|
1279 |
outputs=[
|
1280 |
session_id,
|