coroianpetruta commited on
Commit
8d955ea
1 Parent(s): 44f2a0a

Fixed error

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -48,7 +48,7 @@ def clean_sentence(sentence):
48
  # Example: dialogues = [["Hello, how are you?", "I'm fine, thank you!"], ["What's your name?", "My name is John."]]
49
 
50
  # Function to randomly select one sentence from the dataset
51
- def get_random_sentence(dialogs):
52
  # Select a random dialogue
53
  random_dialogue = random.choice(dialogs['dialog'])
54
  # Select a random sentence from the chosen dialogue
@@ -96,7 +96,6 @@ def save_option_to_repo(trans_prompt, translation1, translation2, button):
96
 
97
 
98
 
99
-
100
  def update_prompt():
101
  prompt.change(value=get_random_sentence())
102
 
@@ -123,7 +122,7 @@ with gr.Blocks() as demo:
123
  option_buttons.append(gr.Button(value="Translation 2"))
124
 
125
  generate.click(get_translations, inputs=prompt, outputs=translations)
126
- example_sentence.click(get_random_sentence(dialogs), outputs=prompt)
127
  for i in range(0,3):
128
  option_buttons[i].click(save_option_to_repo, inputs=[prompt, translations[0], translations[1], option_buttons[i]])
129
 
 
48
  # Example: dialogues = [["Hello, how are you?", "I'm fine, thank you!"], ["What's your name?", "My name is John."]]
49
 
50
  # Function to randomly select one sentence from the dataset
51
+ def get_random_sentence():
52
  # Select a random dialogue
53
  random_dialogue = random.choice(dialogs['dialog'])
54
  # Select a random sentence from the chosen dialogue
 
96
 
97
 
98
 
 
99
  def update_prompt():
100
  prompt.change(value=get_random_sentence())
101
 
 
122
  option_buttons.append(gr.Button(value="Translation 2"))
123
 
124
  generate.click(get_translations, inputs=prompt, outputs=translations)
125
+ example_sentence.click(get_random_sentence(), outputs=prompt)
126
  for i in range(0,3):
127
  option_buttons[i].click(save_option_to_repo, inputs=[prompt, translations[0], translations[1], option_buttons[i]])
128