Spaces:
Sleeping
Sleeping
fruitpicker01
commited on
Commit
•
a86f009
1
Parent(s):
734be83
Update app.py
Browse files
app.py
CHANGED
@@ -812,6 +812,21 @@ def personalize_and_save(
|
|
812 |
save_user_request_to_github(description, advantages, selected_values)
|
813 |
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
# Создание интерфейса Gradio
|
816 |
with gr.Blocks() as demo:
|
817 |
gr.Markdown("# Генерация SMS-сообщений по заданным признакам")
|
@@ -940,32 +955,21 @@ with gr.Blocks() as demo:
|
|
940 |
|
941 |
# Добавление функционала для кнопок
|
942 |
submit_btn.click(
|
943 |
-
|
944 |
-
inputs=[
|
945 |
outputs=[
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
output_text_meta_llama_405b,
|
952 |
-
output_text_meta_llama_70b,
|
953 |
-
output_text_meta_llama_8b,
|
954 |
-
output_text_gemma_27b,
|
955 |
-
output_text_gemma_9b,
|
956 |
-
output_text_mistral,
|
957 |
-
personalization_prompt, # Очищаем персонализированный промпт
|
958 |
-
personalized_output_text_gpt4o,
|
959 |
-
personalized_output_text_gigachat_pro,
|
960 |
-
personalized_output_text_gigachat_lite,
|
961 |
-
personalized_output_text_gigachat_plus,
|
962 |
personalized_output_text_meta_llama_405b,
|
963 |
personalized_output_text_meta_llama_70b,
|
964 |
personalized_output_text_meta_llama_8b,
|
965 |
personalized_output_text_gemma_27b,
|
966 |
personalized_output_text_gemma_9b,
|
967 |
personalized_output_text_mistral,
|
968 |
-
comment_gpt4o,
|
969 |
corrected_gpt4o,
|
970 |
comment_gigachat_pro,
|
971 |
corrected_gigachat_pro,
|
@@ -987,11 +991,12 @@ with gr.Blocks() as demo:
|
|
987 |
corrected_mistral
|
988 |
]
|
989 |
)
|
990 |
-
|
991 |
|
992 |
-
|
993 |
-
|
994 |
-
inputs=[
|
|
|
|
|
995 |
output_text_gpt4o,
|
996 |
output_text_gigachat_pro,
|
997 |
output_text_gigachat_lite,
|
@@ -1001,12 +1006,15 @@ with gr.Blocks() as demo:
|
|
1001 |
output_text_meta_llama_8b,
|
1002 |
output_text_gemma_27b,
|
1003 |
output_text_gemma_9b,
|
1004 |
-
output_text_mistral
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
|
|
|
|
|
|
|
|
1008 |
outputs=[
|
1009 |
-
personalization_prompt,
|
1010 |
personalized_output_text_gpt4o,
|
1011 |
personalized_output_text_gigachat_pro,
|
1012 |
personalized_output_text_gigachat_lite,
|
@@ -1016,8 +1024,8 @@ with gr.Blocks() as demo:
|
|
1016 |
personalized_output_text_meta_llama_8b,
|
1017 |
personalized_output_text_gemma_27b,
|
1018 |
personalized_output_text_gemma_9b,
|
1019 |
-
personalized_output_text_mistral,
|
1020 |
-
comment_gpt4o,
|
1021 |
corrected_gpt4o,
|
1022 |
comment_gigachat_pro,
|
1023 |
corrected_gigachat_pro,
|
@@ -1036,7 +1044,38 @@ with gr.Blocks() as demo:
|
|
1036 |
comment_gemma_9b,
|
1037 |
corrected_gemma_9b,
|
1038 |
comment_mistral,
|
1039 |
-
corrected_mistral
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1040 |
]
|
1041 |
)
|
1042 |
|
|
|
812 |
save_user_request_to_github(description, advantages, selected_values)
|
813 |
|
814 |
|
815 |
+
def clear_fields():
|
816 |
+
return (
|
817 |
+
"", "", "", "", "", "", "", "", "", "", # personalized outputs and prompts
|
818 |
+
"", "", "", "", "", "", "", "", "", "", # comment fields
|
819 |
+
"", "", "", "", "", "", "", "", "", "", # corrected message fields
|
820 |
+
)
|
821 |
+
|
822 |
+
def clear_personalization_fields():
|
823 |
+
return (
|
824 |
+
"", "", "", "", "", "", "", "", "", "", # personalized outputs
|
825 |
+
"", "", "", "", "", "", "", "", "", "", # comment fields
|
826 |
+
"", "", "", "", "", "", "", "", "", "" # corrected message fields
|
827 |
+
)
|
828 |
+
|
829 |
+
|
830 |
# Создание интерфейса Gradio
|
831 |
with gr.Blocks() as demo:
|
832 |
gr.Markdown("# Генерация SMS-сообщений по заданным признакам")
|
|
|
955 |
|
956 |
# Добавление функционала для кнопок
|
957 |
submit_btn.click(
|
958 |
+
clear_fields,
|
959 |
+
inputs=[],
|
960 |
outputs=[
|
961 |
+
personalization_prompt,
|
962 |
+
personalized_output_text_gpt4o,
|
963 |
+
personalized_output_text_gigachat_pro,
|
964 |
+
personalized_output_text_gigachat_lite,
|
965 |
+
personalized_output_text_gigachat_plus,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
966 |
personalized_output_text_meta_llama_405b,
|
967 |
personalized_output_text_meta_llama_70b,
|
968 |
personalized_output_text_meta_llama_8b,
|
969 |
personalized_output_text_gemma_27b,
|
970 |
personalized_output_text_gemma_9b,
|
971 |
personalized_output_text_mistral,
|
972 |
+
comment_gpt4o,
|
973 |
corrected_gpt4o,
|
974 |
comment_gigachat_pro,
|
975 |
corrected_gigachat_pro,
|
|
|
991 |
corrected_mistral
|
992 |
]
|
993 |
)
|
|
|
994 |
|
995 |
+
submit_btn.click(
|
996 |
+
generate_messages,
|
997 |
+
inputs=[description_input, advantages_input] + selections,
|
998 |
+
outputs=[
|
999 |
+
prompt_display,
|
1000 |
output_text_gpt4o,
|
1001 |
output_text_gigachat_pro,
|
1002 |
output_text_gigachat_lite,
|
|
|
1006 |
output_text_meta_llama_8b,
|
1007 |
output_text_gemma_27b,
|
1008 |
output_text_gemma_9b,
|
1009 |
+
output_text_mistral
|
1010 |
+
]
|
1011 |
+
)
|
1012 |
+
|
1013 |
+
|
1014 |
+
personalize_btn.click(
|
1015 |
+
fn=clear_personalization_fields,
|
1016 |
+
inputs=[],
|
1017 |
outputs=[
|
|
|
1018 |
personalized_output_text_gpt4o,
|
1019 |
personalized_output_text_gigachat_pro,
|
1020 |
personalized_output_text_gigachat_lite,
|
|
|
1024 |
personalized_output_text_meta_llama_8b,
|
1025 |
personalized_output_text_gemma_27b,
|
1026 |
personalized_output_text_gemma_9b,
|
1027 |
+
personalized_output_text_mistral, # Поля для персонализированных сообщений
|
1028 |
+
comment_gpt4o,
|
1029 |
corrected_gpt4o,
|
1030 |
comment_gigachat_pro,
|
1031 |
corrected_gigachat_pro,
|
|
|
1044 |
comment_gemma_9b,
|
1045 |
corrected_gemma_9b,
|
1046 |
comment_mistral,
|
1047 |
+
corrected_mistral # Поля для комментариев и откорректированных сообщений
|
1048 |
+
]
|
1049 |
+
)
|
1050 |
+
|
1051 |
+
personalize_btn.click(
|
1052 |
+
fn=personalize_and_save,
|
1053 |
+
inputs=[
|
1054 |
+
output_text_gpt4o,
|
1055 |
+
output_text_gigachat_pro,
|
1056 |
+
output_text_gigachat_lite,
|
1057 |
+
output_text_gigachat_plus,
|
1058 |
+
output_text_meta_llama_405b,
|
1059 |
+
output_text_meta_llama_70b,
|
1060 |
+
output_text_meta_llama_8b,
|
1061 |
+
output_text_gemma_27b,
|
1062 |
+
output_text_gemma_9b,
|
1063 |
+
output_text_mistral, # Входные данные для персонализации
|
1064 |
+
description_input,
|
1065 |
+
advantages_input
|
1066 |
+
] + selections,
|
1067 |
+
outputs=[
|
1068 |
+
personalization_prompt,
|
1069 |
+
personalized_output_text_gpt4o,
|
1070 |
+
personalized_output_text_gigachat_pro,
|
1071 |
+
personalized_output_text_gigachat_lite,
|
1072 |
+
personalized_output_text_gigachat_plus,
|
1073 |
+
personalized_output_text_meta_llama_405b,
|
1074 |
+
personalized_output_text_meta_llama_70b,
|
1075 |
+
personalized_output_text_meta_llama_8b,
|
1076 |
+
personalized_output_text_gemma_27b,
|
1077 |
+
personalized_output_text_gemma_9b,
|
1078 |
+
personalized_output_text_mistral # Выходные данные для персонализации
|
1079 |
]
|
1080 |
)
|
1081 |
|