fruitpicker01 commited on
Commit
3fdcaa5
·
verified ·
1 Parent(s): 50c8dd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -13
app.py CHANGED
@@ -552,7 +552,7 @@ def generate_error_check_prompt():
552
  return prompt
553
 
554
 
555
- 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):
556
  # Собираем все данные в один словарь
557
  data_to_save = {
558
  "Модель": model_name,
@@ -565,6 +565,7 @@ def save_to_github(personalized_message, model_name, comment, corrected_message,
565
  "Подход": approach, # Save approach
566
  "Неперсонализированный промпт": non_personalized_prompt,
567
  "Неперсонализированное сообщение": non_personalized_message,
 
568
  "Пол": gender,
569
  "Поколение": generation,
570
  "Психотип": psychotype,
@@ -782,8 +783,6 @@ with gr.Blocks() as demo:
782
  submit_btn = gr.Button("1. Создать неперсонализированное сообщение")
783
  personalize_btn = gr.Button("2. Выполнить персонализацию (нажимать только после кнопки 1)", elem_id="personalize_button")
784
  load_btn = gr.Button("Вернуть параметры предыдущего запроса")
785
-
786
- gr.Markdown("---") # Добавляет горизонтальную линию
787
 
788
  # Ряд кнопок "Перегенерировать"
789
  with gr.Row():
@@ -1031,8 +1030,8 @@ with gr.Blocks() as demo:
1031
  inputs=[],
1032
  outputs=[save_gpt4o_btn]
1033
  ).then(
1034
- 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:
1035
- 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),
1036
  inputs=[
1037
  personalized_output_text_gpt4o,
1038
  comment_gpt4o,
@@ -1041,6 +1040,7 @@ with gr.Blocks() as demo:
1041
  advantages_input,
1042
  prompt_display,
1043
  output_text_gpt4o,
 
1044
  selections[0], # Пол
1045
  selections[1], # Поколение
1046
  selections[2], # Психотип
@@ -1066,8 +1066,8 @@ with gr.Blocks() as demo:
1066
  inputs=[],
1067
  outputs=[save_gigachat_pro_btn]
1068
  ).then(
1069
- 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:
1070
- 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),
1071
  inputs=[
1072
  personalized_output_text_gigachat_pro,
1073
  comment_gigachat_pro,
@@ -1076,6 +1076,7 @@ with gr.Blocks() as demo:
1076
  advantages_input,
1077
  prompt_display,
1078
  output_text_gigachat_pro,
 
1079
  selections[0], # Пол
1080
  selections[1], # Поколение
1081
  selections[2], # Психотип
@@ -1100,8 +1101,8 @@ with gr.Blocks() as demo:
1100
  inputs=[],
1101
  outputs=[save_gigachat_lite_btn]
1102
  ).then(
1103
- 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:
1104
- 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),
1105
  inputs=[
1106
  personalized_output_text_gigachat_lite,
1107
  comment_gigachat_lite,
@@ -1110,6 +1111,7 @@ with gr.Blocks() as demo:
1110
  advantages_input,
1111
  prompt_display,
1112
  output_text_gigachat_lite,
 
1113
  selections[0], # Пол
1114
  selections[1], # Поколение
1115
  selections[2], # Психотип
@@ -1134,8 +1136,8 @@ with gr.Blocks() as demo:
1134
  inputs=[],
1135
  outputs=[save_gigachat_plus_btn]
1136
  ).then(
1137
- 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:
1138
- 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),
1139
  inputs=[
1140
  personalized_output_text_gigachat_plus,
1141
  comment_gigachat_plus,
@@ -1144,6 +1146,7 @@ with gr.Blocks() as demo:
1144
  advantages_input,
1145
  prompt_display,
1146
  output_text_gigachat_plus,
 
1147
  selections[0], # Пол
1148
  selections[1], # Поколение
1149
  selections[2], # Психотип
@@ -1167,8 +1170,8 @@ with gr.Blocks() as demo:
1167
  inputs=[],
1168
  outputs=[save_meta_llama_405b_btn]
1169
  ).then(
1170
- 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:
1171
- 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),
1172
  inputs=[
1173
  personalized_output_text_meta_llama_405b,
1174
  comment_meta_llama_405b,
@@ -1177,6 +1180,7 @@ with gr.Blocks() as demo:
1177
  advantages_input,
1178
  prompt_display,
1179
  output_text_meta_llama_405b,
 
1180
  selections[0], # Пол
1181
  selections[1], # Поколение
1182
  selections[2], # Психотип
 
552
  return prompt
553
 
554
 
555
+ def save_to_github(personalized_message, model_name, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach):
556
  # Собираем все данные в один словарь
557
  data_to_save = {
558
  "Модель": model_name,
 
565
  "Подход": approach, # Save approach
566
  "Неперсонализированный промпт": non_personalized_prompt,
567
  "Неперсонализированное сообщение": non_personalized_message,
568
+ "Персонализированный промпт": personalization_prompt, # Добавляем персонализированный промпт
569
  "Пол": gender,
570
  "Поколение": generation,
571
  "Психотип": psychotype,
 
783
  submit_btn = gr.Button("1. Создать неперсонализированное сообщение")
784
  personalize_btn = gr.Button("2. Выполнить персонализацию (нажимать только после кнопки 1)", elem_id="personalize_button")
785
  load_btn = gr.Button("Вернуть параметры предыдущего запроса")
 
 
786
 
787
  # Ряд кнопок "Перегенерировать"
788
  with gr.Row():
 
1030
  inputs=[],
1031
  outputs=[save_gpt4o_btn]
1032
  ).then(
1033
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1034
+ save_to_github(personalized_message, "GPT-4o", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1035
  inputs=[
1036
  personalized_output_text_gpt4o,
1037
  comment_gpt4o,
 
1040
  advantages_input,
1041
  prompt_display,
1042
  output_text_gpt4o,
1043
+ personalization_prompt,
1044
  selections[0], # Пол
1045
  selections[1], # Поколение
1046
  selections[2], # Психотип
 
1066
  inputs=[],
1067
  outputs=[save_gigachat_pro_btn]
1068
  ).then(
1069
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1070
+ save_to_github(personalized_message, "GigaChat-Pro", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1071
  inputs=[
1072
  personalized_output_text_gigachat_pro,
1073
  comment_gigachat_pro,
 
1076
  advantages_input,
1077
  prompt_display,
1078
  output_text_gigachat_pro,
1079
+ personalization_prompt,
1080
  selections[0], # Пол
1081
  selections[1], # Поколение
1082
  selections[2], # Психотип
 
1101
  inputs=[],
1102
  outputs=[save_gigachat_lite_btn]
1103
  ).then(
1104
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1105
+ save_to_github(personalized_message, "GigaChat-Lite", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1106
  inputs=[
1107
  personalized_output_text_gigachat_lite,
1108
  comment_gigachat_lite,
 
1111
  advantages_input,
1112
  prompt_display,
1113
  output_text_gigachat_lite,
1114
+ personalization_prompt,
1115
  selections[0], # Пол
1116
  selections[1], # Поколение
1117
  selections[2], # Психотип
 
1136
  inputs=[],
1137
  outputs=[save_gigachat_plus_btn]
1138
  ).then(
1139
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1140
+ save_to_github(personalized_message, "GigaChat-Lite+", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1141
  inputs=[
1142
  personalized_output_text_gigachat_plus,
1143
  comment_gigachat_plus,
 
1146
  advantages_input,
1147
  prompt_display,
1148
  output_text_gigachat_plus,
1149
+ personalization_prompt,
1150
  selections[0], # Пол
1151
  selections[1], # Поколение
1152
  selections[2], # Психотип
 
1170
  inputs=[],
1171
  outputs=[save_meta_llama_405b_btn]
1172
  ).then(
1173
+ fn=lambda personalized_message, comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach:
1174
+ save_to_github(personalized_message, "Meta-Llama-3.1-405B", comment, corrected_message, description, advantages, non_personalized_prompt, non_personalized_message, personalization_prompt, gender, generation, psychotype, business_stage, industry, legal_form, key_message, approach),
1175
  inputs=[
1176
  personalized_output_text_meta_llama_405b,
1177
  comment_meta_llama_405b,
 
1180
  advantages_input,
1181
  prompt_display,
1182
  output_text_meta_llama_405b,
1183
+ personalization_prompt,
1184
  selections[0], # Пол
1185
  selections[1], # Поколение
1186
  selections[2], # Психотип