Spaces:
Runtime error
Runtime error
Fix filename bug
Browse files
app.py
CHANGED
@@ -45,9 +45,16 @@ def clear_cached_images(file_name):
|
|
45 |
if file.startswith(f"errors-{file_name}") and file.endswith(".png"):
|
46 |
os.remove(file)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
def upload_file(file, paper_type):
|
49 |
file_name_cmd = file.name.replace(" ", "\ ")
|
50 |
-
file_name =
|
51 |
clear_cached_images(file_name)
|
52 |
command = f"python3 aclpubcheck-main/aclpubcheck/formatchecker.py --paper_type {paper_type} {file_name_cmd}"
|
53 |
out = subprocess.run(command, shell=True, stdout=subprocess.PIPE, text=True, stderr=subprocess.STDOUT)
|
|
|
45 |
if file.startswith(f"errors-{file_name}") and file.endswith(".png"):
|
46 |
os.remove(file)
|
47 |
|
48 |
+
def get_filename(file):
|
49 |
+
file_name = os.path.basename(file).split(".")[0]
|
50 |
+
if "_" in file_name:
|
51 |
+
# apparently aclpubcheck doesn't like underscores in filenames
|
52 |
+
file_name = file_name.split("_")[0]
|
53 |
+
return file_name
|
54 |
+
|
55 |
def upload_file(file, paper_type):
|
56 |
file_name_cmd = file.name.replace(" ", "\ ")
|
57 |
+
file_name = get_filename(file.name)
|
58 |
clear_cached_images(file_name)
|
59 |
command = f"python3 aclpubcheck-main/aclpubcheck/formatchecker.py --paper_type {paper_type} {file_name_cmd}"
|
60 |
out = subprocess.run(command, shell=True, stdout=subprocess.PIPE, text=True, stderr=subprocess.STDOUT)
|