Spaces:
Runtime error
Runtime error
Update app
Browse files
app.py
CHANGED
@@ -111,10 +111,10 @@ def decode(paragraphs_needed):
|
|
111 |
return contexts
|
112 |
|
113 |
def split_article(article, trigger):
|
114 |
-
if article.split("\n ") > article.split("\\c\\c"): article = article.replace("\n ", "\\c\\c")
|
115 |
paragraphs = article.replace("\\c\\c", "\c\c").split("\\\\c\\\\c")
|
116 |
-
format_pars = [par for par in paragraphs]
|
117 |
pars = [str(par) + " -- " + str(trigger) for par in paragraphs]
|
|
|
|
|
118 |
formatted_input = "\n".join(format_pars)
|
119 |
return pars, formatted_input
|
120 |
|
@@ -163,7 +163,7 @@ As an article writer, your task is to provide an updated paragraph in the length
|
|
163 |
|
164 |
def main(input_article, input_trigger):
|
165 |
paths = [".util/experiments/input_paragraphs.csv",
|
166 |
-
"./util
|
167 |
"./util/experiments/updated_article.txt",
|
168 |
"./util/experiments/paragraphs_needed.txt",
|
169 |
"./util/experiments/updated_paragraphs.txt",
|
@@ -340,8 +340,8 @@ with gr.Blocks() as demo:
|
|
340 |
fn=main,
|
341 |
inputs=[input_1, input_2],
|
342 |
outputs=[output_1, output_2],
|
343 |
-
|
344 |
-
|
345 |
),
|
346 |
com_1_value, com_2_value = "Pls finish article updating, then click the button above", "Pls finish article updating, then click the button above."
|
347 |
with gr.Tab("Compare between versions"):
|
|
|
111 |
return contexts
|
112 |
|
113 |
def split_article(article, trigger):
|
|
|
114 |
paragraphs = article.replace("\\c\\c", "\c\c").split("\\\\c\\\\c")
|
|
|
115 |
pars = [str(par) + " -- " + str(trigger) for par in paragraphs]
|
116 |
+
pd.DataFrame({"paragraphs": paragraphs}).to_csv("./util/experiments/check_par.csv")
|
117 |
+
format_pars = [par for par in paragraphs]
|
118 |
formatted_input = "\n".join(format_pars)
|
119 |
return pars, formatted_input
|
120 |
|
|
|
163 |
|
164 |
def main(input_article, input_trigger):
|
165 |
paths = [".util/experiments/input_paragraphs.csv",
|
166 |
+
"./util/experiments/formatted_input.txt",
|
167 |
"./util/experiments/updated_article.txt",
|
168 |
"./util/experiments/paragraphs_needed.txt",
|
169 |
"./util/experiments/updated_paragraphs.txt",
|
|
|
340 |
fn=main,
|
341 |
inputs=[input_1, input_2],
|
342 |
outputs=[output_1, output_2],
|
343 |
+
cache_examples=True,
|
344 |
+
run_on_click=True,
|
345 |
),
|
346 |
com_1_value, com_2_value = "Pls finish article updating, then click the button above", "Pls finish article updating, then click the button above."
|
347 |
with gr.Tab("Compare between versions"):
|