Spaces:
Runtime error
Runtime error
Fix inputs process
Browse files
app.py
CHANGED
@@ -111,7 +111,10 @@ def decode(paragraphs_needed):
|
|
111 |
return contexts
|
112 |
|
113 |
def split_article(article, trigger):
|
114 |
-
|
|
|
|
|
|
|
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]
|
@@ -170,11 +173,12 @@ def main(input_article, input_trigger):
|
|
170 |
"./util/experiments/paragraphs_with_prompts.csv",
|
171 |
"./util/experiments/classification.csv",
|
172 |
"./util/experiments/paragraphs_needed.csv",
|
173 |
-
"./util/experiments/par_with_class.csv"
|
|
|
174 |
for path in paths:
|
175 |
try:
|
176 |
if os.path.isfile(path): os.remove(path)
|
177 |
-
except:
|
178 |
modified = "TRUE"
|
179 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
180 |
device="cpu"
|
@@ -340,8 +344,8 @@ with gr.Blocks() as demo:
|
|
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"):
|
|
|
111 |
return contexts
|
112 |
|
113 |
def split_article(article, trigger):
|
114 |
+
if len(article.split("\\n ")) > len(article.split("\\\\c\\\\c")):
|
115 |
+
paragraphs = article.split("\\n ")
|
116 |
+
else:
|
117 |
+
paragraphs = article.split("\\\\c\\\\c")
|
118 |
pars = [str(par) + " -- " + str(trigger) for par in paragraphs]
|
119 |
# pd.DataFrame({"paragraphs": paragraphs}).to_csv("./util/experiments/check_par.csv")
|
120 |
format_pars = [par for par in paragraphs]
|
|
|
173 |
"./util/experiments/paragraphs_with_prompts.csv",
|
174 |
"./util/experiments/classification.csv",
|
175 |
"./util/experiments/paragraphs_needed.csv",
|
176 |
+
"./util/experiments/par_with_class.csv",
|
177 |
+
]
|
178 |
for path in paths:
|
179 |
try:
|
180 |
if os.path.isfile(path): os.remove(path)
|
181 |
+
except: continue
|
182 |
modified = "TRUE"
|
183 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
184 |
device="cpu"
|
|
|
344 |
fn=main,
|
345 |
inputs=[input_1, input_2],
|
346 |
outputs=[output_1, output_2],
|
347 |
+
# cache_examples=True,
|
348 |
+
# run_on_click=True,
|
349 |
),
|
350 |
com_1_value, com_2_value = "Pls finish article updating, then click the button above", "Pls finish article updating, then click the button above."
|
351 |
with gr.Tab("Compare between versions"):
|