youngtsai commited on
Commit
f7092d6
·
1 Parent(s): 500c53b

def update_topic_sentence_input(topic_sentences_radio, topic_sentence_output):

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -119,6 +119,7 @@ def generate_topic_sentences(model, max_tokens, sys_content, scenario, eng_level
119
  def update_topic_sentence_input(topic_sentences_radio, topic_sentence_output):
120
  selected_topic_sentence = topic_sentences_radio
121
  topic_sentence_output = json.loads(topic_sentence_output)
 
122
  for ts in topic_sentence_output:
123
  if ts["topic-sentence"] == selected_topic_sentence:
124
  appropriate = "O 適合" if ts["appropriate"] == "Y" else "X 不適合"
@@ -132,9 +133,11 @@ def update_topic_sentence_input(topic_sentences_radio, topic_sentence_output):
132
  <p>原因:{ts['reason']}</p>
133
  </div>
134
  """
 
 
135
  break
136
 
137
- return selected_topic_sentence, suggestion_html
138
 
139
  def generate_supporting_sentences(model, max_tokens, sys_content, scenario, eng_level, topic, points, topic_sentence, user_generate_supporting_sentences_prompt):
140
  """
 
119
  def update_topic_sentence_input(topic_sentences_radio, topic_sentence_output):
120
  selected_topic_sentence = topic_sentences_radio
121
  topic_sentence_output = json.loads(topic_sentence_output)
122
+ topic_sentence_input = ""
123
  for ts in topic_sentence_output:
124
  if ts["topic-sentence"] == selected_topic_sentence:
125
  appropriate = "O 適合" if ts["appropriate"] == "Y" else "X 不適合"
 
133
  <p>原因:{ts['reason']}</p>
134
  </div>
135
  """
136
+
137
+ topic_sentence_input = ts["topic-sentence"] if ts["appropriate"] == "Y" else ""
138
  break
139
 
140
+ return topic_sentence_input, suggestion_html
141
 
142
  def generate_supporting_sentences(model, max_tokens, sys_content, scenario, eng_level, topic, points, topic_sentence, user_generate_supporting_sentences_prompt):
143
  """