Spaces:
Sleeping
Sleeping
fruitpicker01
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -771,17 +771,45 @@ def save_to_github(personalized_message, model_name, comment, corrected_message,
|
|
771 |
response = requests.put(url, headers=headers, data=json.dumps(data))
|
772 |
|
773 |
|
774 |
-
def personalize_and_save(
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
|
786 |
|
787 |
# Создание интерфейса Gradio
|
|
|
771 |
response = requests.put(url, headers=headers, data=json.dumps(data))
|
772 |
|
773 |
|
774 |
+
def personalize_and_save(
|
775 |
+
gpt4o_message,
|
776 |
+
gigachat_pro_message,
|
777 |
+
gigachat_lite_message,
|
778 |
+
gigachat_plus_message,
|
779 |
+
meta_llama_405b_message,
|
780 |
+
meta_llama_70b_message,
|
781 |
+
meta_llama_8b_message,
|
782 |
+
gemma_27b_message,
|
783 |
+
gemma_9b_message,
|
784 |
+
mistral_message,
|
785 |
+
description,
|
786 |
+
advantages,
|
787 |
+
*selected_values
|
788 |
+
):
|
789 |
+
# Персонализация с использованием yield для последовательного вывода
|
790 |
+
personalization_generator = personalize_messages_with_yield(
|
791 |
+
gpt4o_message,
|
792 |
+
gigachat_pro_message,
|
793 |
+
gigachat_lite_message,
|
794 |
+
gigachat_plus_message,
|
795 |
+
meta_llama_405b_message,
|
796 |
+
meta_llama_70b_message,
|
797 |
+
meta_llama_8b_message,
|
798 |
+
gemma_27b_message,
|
799 |
+
gemma_9b_message,
|
800 |
+
mistral_message,
|
801 |
+
*selected_values
|
802 |
+
)
|
803 |
+
|
804 |
+
# Перебираем генератор, чтобы получить все значения и сохранить последний результат
|
805 |
+
last_personalization_result = None
|
806 |
+
for personalization_result in personalization_generator:
|
807 |
+
last_personalization_result = personalization_result
|
808 |
+
yield personalization_result # Отображаем результаты по мере их появления
|
809 |
+
|
810 |
+
# После завершения персонализации, сохраняем результаты
|
811 |
+
if last_personalization_result:
|
812 |
+
save_user_request_to_github(last_personalization_result[1], last_personalization_result[2], selected_values)
|
813 |
|
814 |
|
815 |
# Создание интерфейса Gradio
|