Spaces:
Sleeping
Sleeping
fruitpicker01
commited on
Commit
•
538b376
1
Parent(s):
8a8a48b
Update app.py
Browse files
app.py
CHANGED
@@ -668,7 +668,7 @@ def clean_prompt_for_display(prompt, prefixes, suffixes):
|
|
668 |
return cleaned_prompt.strip()
|
669 |
|
670 |
# Функция для постепенной генерации всех сообщений через yield
|
671 |
-
def generate_all_messages(desc, benefits, key_message, gender, generation, psychotype, business_stage, industry, opf, product_name):
|
672 |
standard_prompt = generate_standard_prompt(desc, benefits, key_message)
|
673 |
standard_prompt_for_display = f"Не изменяй название продукта: {product_name}.\n{standard_prompt}\nУбедись, что в готовом тексте без изменений, синонимов и перестановок слов используется наименование продукта: {product_name}.\n"
|
674 |
approach_mapping = {
|
@@ -740,7 +740,7 @@ def generate_all_messages(desc, benefits, key_message, gender, generation, psych
|
|
740 |
yield selected_approaches_text_content, standard_prompt_for_display, display_personalization_prompt, None, None
|
741 |
flag += 1
|
742 |
prompt = add_prefix_suffix(standard_prompt, current_prefix, current_suffix, product_name)
|
743 |
-
non_personalized_message = generate_message_mistral_with_retry(prompt, approach_name, desc, key_message, product_name)
|
744 |
non_personalized_length = len(non_personalized_message)
|
745 |
non_personalized_display = f"{non_personalized_message}\n------\nКоличество знаков: {non_personalized_length}"
|
746 |
if non_personalized_messages:
|
@@ -752,7 +752,7 @@ def generate_all_messages(desc, benefits, key_message, gender, generation, psych
|
|
752 |
non_personalized_messages, personalized_messages
|
753 |
)
|
754 |
full_personalized_prompt = f"{personalization_prompt}\n\nТекст для адаптации: {non_personalized_message}"
|
755 |
-
personalized_message = generate_message_mistral_with_retry(full_personalized_prompt, approach_name, desc, key_message, product_name)
|
756 |
personalized_length = len(personalized_message)
|
757 |
personalized_display = f"{personalized_message}\n------\nКоличество знаков: {personalized_length}"
|
758 |
if personalized_messages:
|
@@ -1752,7 +1752,7 @@ with gr.Blocks() as demo:
|
|
1752 |
outputs=tabs
|
1753 |
).then(
|
1754 |
fn=generate_all_messages,
|
1755 |
-
inputs=[desc, benefits, key_message, gender, generation, psychotype, business_stage, industry, opf, product_name],
|
1756 |
outputs=[
|
1757 |
selected_approaches_text,
|
1758 |
non_personalized_prompt, personalized_prompt,
|
|
|
668 |
return cleaned_prompt.strip()
|
669 |
|
670 |
# Функция для постепенной генерации всех сообщений через yield
|
671 |
+
def generate_all_messages(desc, benefits, key_message, gender, generation, psychotype, business_stage, industry, opf, product_name, advantages):
|
672 |
standard_prompt = generate_standard_prompt(desc, benefits, key_message)
|
673 |
standard_prompt_for_display = f"Не изменяй название продукта: {product_name}.\n{standard_prompt}\nУбедись, что в готовом тексте без изменений, синонимов и перестановок слов используется наименование продукта: {product_name}.\n"
|
674 |
approach_mapping = {
|
|
|
740 |
yield selected_approaches_text_content, standard_prompt_for_display, display_personalization_prompt, None, None
|
741 |
flag += 1
|
742 |
prompt = add_prefix_suffix(standard_prompt, current_prefix, current_suffix, product_name)
|
743 |
+
non_personalized_message = generate_message_mistral_with_retry(prompt, approach_name, desc, key_message, product_name, advantages)
|
744 |
non_personalized_length = len(non_personalized_message)
|
745 |
non_personalized_display = f"{non_personalized_message}\n------\nКоличество знаков: {non_personalized_length}"
|
746 |
if non_personalized_messages:
|
|
|
752 |
non_personalized_messages, personalized_messages
|
753 |
)
|
754 |
full_personalized_prompt = f"{personalization_prompt}\n\nТекст для адаптации: {non_personalized_message}"
|
755 |
+
personalized_message = generate_message_mistral_with_retry(full_personalized_prompt, approach_name, desc, key_message, product_name, advantages)
|
756 |
personalized_length = len(personalized_message)
|
757 |
personalized_display = f"{personalized_message}\n------\nКоличество знаков: {personalized_length}"
|
758 |
if personalized_messages:
|
|
|
1752 |
outputs=tabs
|
1753 |
).then(
|
1754 |
fn=generate_all_messages,
|
1755 |
+
inputs=[desc, benefits, key_message, gender, generation, psychotype, business_stage, industry, opf, product_name, advantages],
|
1756 |
outputs=[
|
1757 |
selected_approaches_text,
|
1758 |
non_personalized_prompt, personalized_prompt,
|