fruitpicker01 commited on
Commit
b969fe8
·
verified ·
1 Parent(s): 1b66bb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -755,6 +755,17 @@ def save_to_github(personalized_message, model_name, comment, corrected_message,
755
  response = requests.put(url, headers=headers, data=json.dumps(data))
756
 
757
 
 
 
 
 
 
 
 
 
 
 
 
758
  # Создание интерфейса Gradio
759
  with gr.Blocks() as demo:
760
  gr.Markdown("# Генерация SMS-сообщений по заданным признакам")
@@ -901,10 +912,7 @@ with gr.Blocks() as demo:
901
  )
902
 
903
  personalize_btn.click(
904
- fn=lambda gpt4o_message, gigachat_pro_message, gigachat_lite_message, gigachat_plus_message, meta_llama_405b_message, meta_llama_70b_message, meta_llama_8b_message, gemma_27b_message, gemma_9b_message, mistral_message, description, advantages, *selected_values: (
905
- personalize_messages_with_yield(gpt4o_message, gigachat_pro_message, gigachat_lite_message, gigachat_plus_message, meta_llama_405b_message, meta_llama_70b_message, meta_llama_8b_message, gemma_27b_message, gemma_9b_message, mistral_message, *selected_values),
906
- save_user_request_to_github(description, advantages, selected_values)
907
- ),
908
  inputs=[
909
  output_text_gpt4o,
910
  output_text_gigachat_pro,
 
755
  response = requests.put(url, headers=headers, data=json.dumps(data))
756
 
757
 
758
+ def personalize_and_save(gpt4o_message, gigachat_pro_message, gigachat_lite_message, gigachat_plus_message, meta_llama_405b_message, meta_llama_70b_message, meta_llama_8b_message, gemma_27b_message, gemma_9b_message, mistral_message, description, advantages, *selected_values):
759
+ personalization_results = list(personalize_messages_with_yield(
760
+ gpt4o_message, gigachat_pro_message, gigachat_lite_message, gigachat_plus_message, meta_llama_405b_message, meta_llama_70b_message, meta_llama_8b_message, gemma_27b_message, gemma_9b_message, mistral_message, *selected_values
761
+ ))
762
+
763
+ # Save to GitHub after the personalization
764
+ save_user_request_to_github(description, advantages, selected_values)
765
+
766
+ return personalization_results[-1] # Return the last set of outputs from personalization
767
+
768
+
769
  # Создание интерфейса Gradio
770
  with gr.Blocks() as demo:
771
  gr.Markdown("# Генерация SMS-сообщений по заданным признакам")
 
912
  )
913
 
914
  personalize_btn.click(
915
+ fn=personalize_and_save,
 
 
 
916
  inputs=[
917
  output_text_gpt4o,
918
  output_text_gigachat_pro,