fruitpicker01 commited on
Commit
c79ae24
·
verified ·
1 Parent(s): aaf1217

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +94 -68
app.py CHANGED
@@ -110,7 +110,7 @@ def load_previous_user_request_from_github():
110
 
111
  if not json_files:
112
  print("Нет сохраненных запросов.")
113
- return "", "", "", "", None, None, None, None, None, None
114
 
115
  # Определяем новый индекс для загрузки предыдущего файла
116
  current_request_index -= 1
@@ -129,18 +129,18 @@ def load_previous_user_request_from_github():
129
  data = json.loads(file_response.text)
130
  description = data.get('description', "")
131
  advantages = data.get('advantages', "")
 
 
132
  personalization_params = data.get('personalization_params', [None] * 6) # Убедитесь, что размер списка соответствует количеству полей
133
- key_message = data.get('key_message', "")
134
- approach = data.get('approach', "")
135
 
136
  # Возвращаем данные по отдельности для каждого компонента Gradio
137
  return description, advantages, key_message, approach, *personalization_params
138
  else:
139
  print(f"Ошибка при загрузке файла: {file_response.status_code}")
140
- return "", "", "", "", None, None, None, None, None, None
141
  else:
142
  print(f"Ошибка при обращении к GitHub: {response.status_code}")
143
- return "", "", "", "", None, None, None, None, None, None
144
 
145
 
146
  # Функция для генерации стандартного промпта
@@ -766,7 +766,7 @@ def check_errors_with_yield(*personalized_messages):
766
  yield error_check_prompt, error_message_gpt4o, error_message_gigachat_pro, error_message_gigachat_lite, error_message_gigachat_plus, error_message_meta_llama_405b, error_message_meta_llama_70b, error_message_meta_llama_8b, error_message_gemma_27b_it, error_message_gemma_9b_it, error_message_mistral, "Все результаты проверки сгенерированы"
767
 
768
 
769
- def save_to_github(personalized_message, model_name, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form):
770
  # Собираем все данные в один словарь
771
  data_to_save = {
772
  "Модель": model_name,
@@ -775,6 +775,8 @@ def save_to_github(personalized_message, model_name, comment, corrected_message,
775
  "Откорректированное сообщение": corrected_message,
776
  "Описание предложения": description,
777
  "Преимущества": advantages,
 
 
778
  "Неперсонализированный промпт": non_personalized_prompt,
779
  "Неперсонализированное сообщение": non_personalized_message,
780
  "Пол": gender,
@@ -850,7 +852,6 @@ def personalize_and_save(
850
  save_user_request_to_github(description, advantages, key_message, approach, selected_values)
851
 
852
 
853
-
854
  def clear_fields():
855
  return (
856
  "", "", "", "", "", "", "", "", "", "", # personalized outputs and prompts
@@ -1162,6 +1163,8 @@ with gr.Blocks() as demo:
1162
  outputs=[
1163
  description_input, # Описание предложения
1164
  advantages_input, # Преимущества
 
 
1165
  *selections, # Параметры персонализации (Пол, Поколение и т.д.)
1166
  ]
1167
  ).then(
@@ -1220,8 +1223,8 @@ with gr.Blocks() as demo:
1220
  inputs=[],
1221
  outputs=[save_gpt4o_btn]
1222
  ).then(
1223
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1224
- save_to_github(personalized_message, "GPT-4o", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1225
  inputs=[
1226
  personalized_output_text_gpt4o,
1227
  comment_gpt4o,
@@ -1235,7 +1238,9 @@ with gr.Blocks() as demo:
1235
  selections[2], # Психотип
1236
  selections[3], # Стадия бизнеса
1237
  selections[4], # Отрасль
1238
- selections[5] # ОПФ
 
 
1239
  ],
1240
  outputs=None
1241
  ).then(
@@ -1245,15 +1250,16 @@ with gr.Blocks() as demo:
1245
  fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1246
  outputs=[save_gpt4o_btn]
1247
  )
1248
-
1249
-
 
1250
  save_gigachat_pro_btn.click(
1251
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1252
  inputs=[],
1253
  outputs=[save_gigachat_pro_btn]
1254
  ).then(
1255
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1256
- save_to_github(personalized_message, "GigaChat-Pro", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1257
  inputs=[
1258
  personalized_output_text_gigachat_pro,
1259
  comment_gigachat_pro,
@@ -1267,24 +1273,27 @@ with gr.Blocks() as demo:
1267
  selections[2], # Психотип
1268
  selections[3], # Стадия бизнеса
1269
  selections[4], # Отрасль
1270
- selections[5] # ОПФ
 
 
1271
  ],
1272
  outputs=None
1273
  ).then(
1274
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1275
  outputs=[save_gigachat_pro_btn]
1276
  ).then(
1277
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1278
  outputs=[save_gigachat_pro_btn]
1279
  )
1280
-
 
1281
  save_gigachat_lite_btn.click(
1282
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1283
  inputs=[],
1284
  outputs=[save_gigachat_lite_btn]
1285
  ).then(
1286
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1287
- save_to_github(personalized_message, "GigaChat-Lite", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1288
  inputs=[
1289
  personalized_output_text_gigachat_lite,
1290
  comment_gigachat_lite,
@@ -1298,24 +1307,27 @@ with gr.Blocks() as demo:
1298
  selections[2], # Психотип
1299
  selections[3], # Стадия бизнеса
1300
  selections[4], # Отрасль
1301
- selections[5] # ОПФ
 
 
1302
  ],
1303
  outputs=None
1304
  ).then(
1305
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1306
  outputs=[save_gigachat_lite_btn]
1307
  ).then(
1308
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1309
  outputs=[save_gigachat_lite_btn]
1310
  )
1311
 
 
1312
  save_gigachat_plus_btn.click(
1313
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1314
  inputs=[],
1315
  outputs=[save_gigachat_plus_btn]
1316
  ).then(
1317
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1318
- save_to_github(personalized_message, "GigaChat-Lite+", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1319
  inputs=[
1320
  personalized_output_text_gigachat_plus,
1321
  comment_gigachat_plus,
@@ -1329,24 +1341,26 @@ with gr.Blocks() as demo:
1329
  selections[2], # Психотип
1330
  selections[3], # Стадия бизнеса
1331
  selections[4], # Отрасль
1332
- selections[5] # ОПФ
 
 
1333
  ],
1334
  outputs=None
1335
  ).then(
1336
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1337
  outputs=[save_gigachat_plus_btn]
1338
  ).then(
1339
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1340
  outputs=[save_gigachat_plus_btn]
1341
  )
1342
-
1343
  save_meta_llama_405b_btn.click(
1344
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1345
  inputs=[],
1346
  outputs=[save_meta_llama_405b_btn]
1347
  ).then(
1348
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1349
- save_to_github(personalized_message, "Meta-Llama-3.1-405B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1350
  inputs=[
1351
  personalized_output_text_meta_llama_405b,
1352
  comment_meta_llama_405b,
@@ -1360,24 +1374,26 @@ with gr.Blocks() as demo:
1360
  selections[2], # Психотип
1361
  selections[3], # Стадия бизнеса
1362
  selections[4], # Отрасль
1363
- selections[5] # ОПФ
 
 
1364
  ],
1365
  outputs=None
1366
  ).then(
1367
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1368
  outputs=[save_meta_llama_405b_btn]
1369
  ).then(
1370
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1371
  outputs=[save_meta_llama_405b_btn]
1372
  )
1373
 
1374
  save_meta_llama_70b_btn.click(
1375
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1376
  inputs=[],
1377
  outputs=[save_meta_llama_70b_btn]
1378
  ).then(
1379
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1380
- save_to_github(personalized_message, "Meta-Llama-3.1-70B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1381
  inputs=[
1382
  personalized_output_text_meta_llama_70b,
1383
  comment_meta_llama_70b,
@@ -1391,24 +1407,26 @@ with gr.Blocks() as demo:
1391
  selections[2], # Психотип
1392
  selections[3], # Стадия бизнеса
1393
  selections[4], # Отрасль
1394
- selections[5] # ОПФ
 
 
1395
  ],
1396
  outputs=None
1397
  ).then(
1398
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1399
  outputs=[save_meta_llama_70b_btn]
1400
  ).then(
1401
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1402
  outputs=[save_meta_llama_70b_btn]
1403
  )
1404
 
1405
  save_meta_llama_8b_btn.click(
1406
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1407
  inputs=[],
1408
  outputs=[save_meta_llama_8b_btn]
1409
  ).then(
1410
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1411
- save_to_github(personalized_message, "Meta-Llama-3.1-8B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1412
  inputs=[
1413
  personalized_output_text_meta_llama_8b,
1414
  comment_meta_llama_8b,
@@ -1422,24 +1440,26 @@ with gr.Blocks() as demo:
1422
  selections[2], # Психотип
1423
  selections[3], # Стадия бизнеса
1424
  selections[4], # Отрасль
1425
- selections[5] # ОПФ
 
 
1426
  ],
1427
  outputs=None
1428
  ).then(
1429
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1430
  outputs=[save_meta_llama_8b_btn]
1431
  ).then(
1432
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1433
  outputs=[save_meta_llama_8b_btn]
1434
  )
1435
 
1436
  save_gemma_27b_btn.click(
1437
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1438
  inputs=[],
1439
  outputs=[save_gemma_27b_btn]
1440
  ).then(
1441
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1442
- save_to_github(personalized_message, "Gemma-2-27B-IT", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1443
  inputs=[
1444
  personalized_output_text_gemma_27b,
1445
  comment_gemma_27b,
@@ -1453,24 +1473,26 @@ with gr.Blocks() as demo:
1453
  selections[2], # Психотип
1454
  selections[3], # Стадия бизнеса
1455
  selections[4], # Отрасль
1456
- selections[5] # ОПФ
 
 
1457
  ],
1458
  outputs=None
1459
  ).then(
1460
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1461
  outputs=[save_gemma_27b_btn]
1462
  ).then(
1463
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1464
  outputs=[save_gemma_27b_btn]
1465
  )
1466
 
1467
  save_gemma_9b_btn.click(
1468
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1469
  inputs=[],
1470
  outputs=[save_gemma_9b_btn]
1471
  ).then(
1472
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1473
- save_to_github(personalized_message, "Gemma-2-9B-IT", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1474
  inputs=[
1475
  personalized_output_text_gemma_9b,
1476
  comment_gemma_9b,
@@ -1484,24 +1506,26 @@ with gr.Blocks() as demo:
1484
  selections[2], # Психотип
1485
  selections[3], # Стадия бизнеса
1486
  selections[4], # Отрасль
1487
- selections[5] # ОПФ
 
 
1488
  ],
1489
  outputs=None
1490
  ).then(
1491
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1492
  outputs=[save_gemma_9b_btn]
1493
  ).then(
1494
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1495
  outputs=[save_gemma_9b_btn]
1496
  )
1497
 
1498
  save_mistral_btn.click(
1499
- fn=prepare_button_text, # Сначала меняем текст на "Сохраняется..."
1500
  inputs=[],
1501
  outputs=[save_mistral_btn]
1502
  ).then(
1503
- fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form:
1504
- save_to_github(personalized_message, "Mistral", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form),
1505
  inputs=[
1506
  personalized_output_text_mistral,
1507
  comment_mistral,
@@ -1515,14 +1539,16 @@ with gr.Blocks() as demo:
1515
  selections[2], # Психотип
1516
  selections[3], # Стадия бизнеса
1517
  selections[4], # Отрасль
1518
- selections[5] # ОПФ
 
 
1519
  ],
1520
  outputs=None
1521
  ).then(
1522
- fn=update_button_text, # Обновляем текст на "Сохранено!" после сохранения
1523
  outputs=[save_mistral_btn]
1524
  ).then(
1525
- fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1526
  outputs=[save_mistral_btn]
1527
  )
1528
 
 
110
 
111
  if not json_files:
112
  print("Нет сохраненных запросов.")
113
+ return "", "", "", "", "", "", "", "", "", "", None, None, None, None, None, None
114
 
115
  # Определяем новый индекс для загрузки предыдущего файла
116
  current_request_index -= 1
 
129
  data = json.loads(file_response.text)
130
  description = data.get('description', "")
131
  advantages = data.get('advantages', "")
132
+ key_message = data.get('key_message', "") # Load key message
133
+ approach = data.get('approach', "") # Load approach
134
  personalization_params = data.get('personalization_params', [None] * 6) # Убедитесь, что размер списка соответствует количеству полей
 
 
135
 
136
  # Возвращаем данные по отдельности для каждого компонента Gradio
137
  return description, advantages, key_message, approach, *personalization_params
138
  else:
139
  print(f"Ошибка при загрузке файла: {file_response.status_code}")
140
+ return "", "", "", "", "", "", "", "", "", "", None, None, None, None, None, None
141
  else:
142
  print(f"Ошибка при обращении к GitHub: {response.status_code}")
143
+ return "", "", "", "", "", "", "", "", "", "", None, None, None, None, None, None
144
 
145
 
146
  # Функция для генерации стандартного промпта
 
766
  yield error_check_prompt, error_message_gpt4o, error_message_gigachat_pro, error_message_gigachat_lite, error_message_gigachat_plus, error_message_meta_llama_405b, error_message_meta_llama_70b, error_message_meta_llama_8b, error_message_gemma_27b_it, error_message_gemma_9b_it, error_message_mistral, "Все результаты проверки сгенерированы"
767
 
768
 
769
+ def save_to_github(personalized_message, model_name, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach):
770
  # Собираем все данные в один словарь
771
  data_to_save = {
772
  "Модель": model_name,
 
775
  "Откорректированное сообщение": corrected_message,
776
  "Описание предложения": description,
777
  "Преимущества": advantages,
778
+ "Ключевое сообщение": key_message, # Save key message
779
+ "Подход": approach, # Save approach
780
  "Неперсонализированный промпт": non_personalized_prompt,
781
  "Неперсонализированное сообщение": non_personalized_message,
782
  "Пол": gender,
 
852
  save_user_request_to_github(description, advantages, key_message, approach, selected_values)
853
 
854
 
 
855
  def clear_fields():
856
  return (
857
  "", "", "", "", "", "", "", "", "", "", # personalized outputs and prompts
 
1163
  outputs=[
1164
  description_input, # Описание предложения
1165
  advantages_input, # Преимущества
1166
+ key_message_input, # Ключевое сообщение
1167
+ approach_input, # Подход
1168
  *selections, # Параметры персонализации (Пол, Поколение и т.д.)
1169
  ]
1170
  ).then(
 
1223
  inputs=[],
1224
  outputs=[save_gpt4o_btn]
1225
  ).then(
1226
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1227
+ save_to_github(personalized_message, "GPT-4o", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1228
  inputs=[
1229
  personalized_output_text_gpt4o,
1230
  comment_gpt4o,
 
1238
  selections[2], # Психотип
1239
  selections[3], # Стадия бизнеса
1240
  selections[4], # Отрасль
1241
+ selections[5], # ОПФ
1242
+ key_message_input, # Ключевое сообщение
1243
+ approach_input # Подход
1244
  ],
1245
  outputs=None
1246
  ).then(
 
1250
  fn=reset_button_text, # Возвращаем текст на кнопке обратно через 3 секунды
1251
  outputs=[save_gpt4o_btn]
1252
  )
1253
+
1254
+ # То же самое для других кнопок:
1255
+
1256
  save_gigachat_pro_btn.click(
1257
+ fn=prepare_button_text,
1258
  inputs=[],
1259
  outputs=[save_gigachat_pro_btn]
1260
  ).then(
1261
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1262
+ save_to_github(personalized_message, "GigaChat-Pro", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1263
  inputs=[
1264
  personalized_output_text_gigachat_pro,
1265
  comment_gigachat_pro,
 
1273
  selections[2], # Психотип
1274
  selections[3], # Стадия бизнеса
1275
  selections[4], # Отрасль
1276
+ selections[5], # ОПФ
1277
+ key_message_input, # Ключевое сообщение
1278
+ approach_input # Подход
1279
  ],
1280
  outputs=None
1281
  ).then(
1282
+ fn=update_button_text,
1283
  outputs=[save_gigachat_pro_btn]
1284
  ).then(
1285
+ fn=reset_button_text,
1286
  outputs=[save_gigachat_pro_btn]
1287
  )
1288
+
1289
+ # Повторяем аналогично для других кнопок:
1290
  save_gigachat_lite_btn.click(
1291
+ fn=prepare_button_text,
1292
  inputs=[],
1293
  outputs=[save_gigachat_lite_btn]
1294
  ).then(
1295
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1296
+ save_to_github(personalized_message, "GigaChat-Lite", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1297
  inputs=[
1298
  personalized_output_text_gigachat_lite,
1299
  comment_gigachat_lite,
 
1307
  selections[2], # Психотип
1308
  selections[3], # Стадия бизнеса
1309
  selections[4], # Отрасль
1310
+ selections[5], # ОПФ
1311
+ key_message_input, # Ключевое сообщение
1312
+ approach_input # Подход
1313
  ],
1314
  outputs=None
1315
  ).then(
1316
+ fn=update_button_text,
1317
  outputs=[save_gigachat_lite_btn]
1318
  ).then(
1319
+ fn=reset_button_text,
1320
  outputs=[save_gigachat_lite_btn]
1321
  )
1322
 
1323
+
1324
  save_gigachat_plus_btn.click(
1325
+ fn=prepare_button_text,
1326
  inputs=[],
1327
  outputs=[save_gigachat_plus_btn]
1328
  ).then(
1329
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1330
+ save_to_github(personalized_message, "GigaChat-Lite+", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1331
  inputs=[
1332
  personalized_output_text_gigachat_plus,
1333
  comment_gigachat_plus,
 
1341
  selections[2], # Психотип
1342
  selections[3], # Стадия бизнеса
1343
  selections[4], # Отрасль
1344
+ selections[5], # ОПФ
1345
+ key_message_input, # Ключевое сообщение
1346
+ approach_input # Подход
1347
  ],
1348
  outputs=None
1349
  ).then(
1350
+ fn=update_button_text,
1351
  outputs=[save_gigachat_plus_btn]
1352
  ).then(
1353
+ fn=reset_button_text,
1354
  outputs=[save_gigachat_plus_btn]
1355
  )
1356
+
1357
  save_meta_llama_405b_btn.click(
1358
+ fn=prepare_button_text,
1359
  inputs=[],
1360
  outputs=[save_meta_llama_405b_btn]
1361
  ).then(
1362
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1363
+ save_to_github(personalized_message, "Meta-Llama-3.1-405B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1364
  inputs=[
1365
  personalized_output_text_meta_llama_405b,
1366
  comment_meta_llama_405b,
 
1374
  selections[2], # Психотип
1375
  selections[3], # Стадия бизнеса
1376
  selections[4], # Отрасль
1377
+ selections[5], # ОПФ
1378
+ key_message_input, # Ключевое сообщение
1379
+ approach_input # Подход
1380
  ],
1381
  outputs=None
1382
  ).then(
1383
+ fn=update_button_text,
1384
  outputs=[save_meta_llama_405b_btn]
1385
  ).then(
1386
+ fn=reset_button_text,
1387
  outputs=[save_meta_llama_405b_btn]
1388
  )
1389
 
1390
  save_meta_llama_70b_btn.click(
1391
+ fn=prepare_button_text,
1392
  inputs=[],
1393
  outputs=[save_meta_llama_70b_btn]
1394
  ).then(
1395
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1396
+ save_to_github(personalized_message, "Meta-Llama-3.1-70B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1397
  inputs=[
1398
  personalized_output_text_meta_llama_70b,
1399
  comment_meta_llama_70b,
 
1407
  selections[2], # Психотип
1408
  selections[3], # Стадия бизнеса
1409
  selections[4], # Отрасль
1410
+ selections[5], # ОПФ
1411
+ key_message_input, # Ключевое сообщение
1412
+ approach_input # Подход
1413
  ],
1414
  outputs=None
1415
  ).then(
1416
+ fn=update_button_text,
1417
  outputs=[save_meta_llama_70b_btn]
1418
  ).then(
1419
+ fn=reset_button_text,
1420
  outputs=[save_meta_llama_70b_btn]
1421
  )
1422
 
1423
  save_meta_llama_8b_btn.click(
1424
+ fn=prepare_button_text,
1425
  inputs=[],
1426
  outputs=[save_meta_llama_8b_btn]
1427
  ).then(
1428
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1429
+ save_to_github(personalized_message, "Meta-Llama-3.1-8B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1430
  inputs=[
1431
  personalized_output_text_meta_llama_8b,
1432
  comment_meta_llama_8b,
 
1440
  selections[2], # Психотип
1441
  selections[3], # Стадия бизнеса
1442
  selections[4], # Отрасль
1443
+ selections[5], # ОПФ
1444
+ key_message_input, # Ключевое сообщение
1445
+ approach_input # Подход
1446
  ],
1447
  outputs=None
1448
  ).then(
1449
+ fn=update_button_text,
1450
  outputs=[save_meta_llama_8b_btn]
1451
  ).then(
1452
+ fn=reset_button_text,
1453
  outputs=[save_meta_llama_8b_btn]
1454
  )
1455
 
1456
  save_gemma_27b_btn.click(
1457
+ fn=prepare_button_text,
1458
  inputs=[],
1459
  outputs=[save_gemma_27b_btn]
1460
  ).then(
1461
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1462
+ save_to_github(personalized_message, "Gemma-2-27B-IT", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1463
  inputs=[
1464
  personalized_output_text_gemma_27b,
1465
  comment_gemma_27b,
 
1473
  selections[2], # Психотип
1474
  selections[3], # Стадия бизнеса
1475
  selections[4], # Отрасль
1476
+ selections[5], # ОПФ
1477
+ key_message_input, # Ключевое сообщение
1478
+ approach_input # Подход
1479
  ],
1480
  outputs=None
1481
  ).then(
1482
+ fn=update_button_text,
1483
  outputs=[save_gemma_27b_btn]
1484
  ).then(
1485
+ fn=reset_button_text,
1486
  outputs=[save_gemma_27b_btn]
1487
  )
1488
 
1489
  save_gemma_9b_btn.click(
1490
+ fn=prepare_button_text,
1491
  inputs=[],
1492
  outputs=[save_gemma_9b_btn]
1493
  ).then(
1494
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1495
+ save_to_github(personalized_message, "Gemma-2-9B-IT", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1496
  inputs=[
1497
  personalized_output_text_gemma_9b,
1498
  comment_gemma_9b,
 
1506
  selections[2], # Психотип
1507
  selections[3], # Стадия бизнеса
1508
  selections[4], # Отрасль
1509
+ selections[5], # ОПФ
1510
+ key_message_input, # Ключевое сообщение
1511
+ approach_input # Подход
1512
  ],
1513
  outputs=None
1514
  ).then(
1515
+ fn=update_button_text,
1516
  outputs=[save_gemma_9b_btn]
1517
  ).then(
1518
+ fn=reset_button_text,
1519
  outputs=[save_gemma_9b_btn]
1520
  )
1521
 
1522
  save_mistral_btn.click(
1523
+ fn=prepare_button_text,
1524
  inputs=[],
1525
  outputs=[save_mistral_btn]
1526
  ).then(
1527
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1528
+ save_to_github(personalized_message, "Mistral", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1529
  inputs=[
1530
  personalized_output_text_mistral,
1531
  comment_mistral,
 
1539
  selections[2], # Психотип
1540
  selections[3], # Стадия бизнеса
1541
  selections[4], # Отрасль
1542
+ selections[5], # ОПФ
1543
+ key_message_input, # Ключевое сообщение
1544
+ approach_input # Подход
1545
  ],
1546
  outputs=None
1547
  ).then(
1548
+ fn=update_button_text,
1549
  outputs=[save_mistral_btn]
1550
  ).then(
1551
+ fn=reset_button_text,
1552
  outputs=[save_mistral_btn]
1553
  )
1554