Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -238,6 +238,8 @@ def wrap_text(text, task_value):
|
|
238 |
return task_value.format(text)
|
239 |
# Text input
|
240 |
user_input = st.text_area("Enter text below **(PLEASE, FIRST READ ALL INSTRUCTIONS IN THE SIDEBAR CAREFULLY FOR THE BEST EXPERIENCE)**: ", sample_texts.get(sample_text, sample_text))
|
|
|
|
|
241 |
if task == "select":
|
242 |
user_input = instruction_wrap.get(user_input, user_input)
|
243 |
|
@@ -280,8 +282,7 @@ if st.button("Generate"):
|
|
280 |
generated_text = asyncio.run(assign_topic(generated_text))
|
281 |
|
282 |
elif task == "Translation" or "<translate>" in wrapped_input:
|
283 |
-
n_sentences
|
284 |
-
print("split for translation: ", n_sentences, re.split(r"\.|\n", generated_text)[:n_sentences], re.split(r"\.|\n", user_input))
|
285 |
generated_text = ".".join(re.split(r"\.|\n", generated_text)[:n_sentences])
|
286 |
|
287 |
elif task == "Question Generation" or "Question Generation:" in sample_text:
|
|
|
238 |
return task_value.format(text)
|
239 |
# Text input
|
240 |
user_input = st.text_area("Enter text below **(PLEASE, FIRST READ ALL INSTRUCTIONS IN THE SIDEBAR CAREFULLY FOR THE BEST EXPERIENCE)**: ", sample_texts.get(sample_text, sample_text))
|
241 |
+
n_sentences = len(re.split(r"\.|\n", user_input))
|
242 |
+
|
243 |
if task == "select":
|
244 |
user_input = instruction_wrap.get(user_input, user_input)
|
245 |
|
|
|
282 |
generated_text = asyncio.run(assign_topic(generated_text))
|
283 |
|
284 |
elif task == "Translation" or "<translate>" in wrapped_input:
|
285 |
+
print("split for translation: ", n_sentences, re.split(r"\.|\n", generated_text)[:n_sentences])
|
|
|
286 |
generated_text = ".".join(re.split(r"\.|\n", generated_text)[:n_sentences])
|
287 |
|
288 |
elif task == "Question Generation" or "Question Generation:" in sample_text:
|