Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import re
|
|
9 |
import matplotlib.pyplot as plt
|
10 |
import matplotlib.patches as patches
|
11 |
import io
|
|
|
12 |
# Initialize spaCy model
|
13 |
nlp = spacy.load('en_core_web_sm')
|
14 |
nlp.add_pipe('sentencizer')
|
@@ -49,9 +50,7 @@ def upload_file_and_update_dropdown(file):
|
|
49 |
if file is not None:
|
50 |
# Save the file to the upload directory
|
51 |
file_path = os.path.join(PDF_FOLDER, file.name)
|
52 |
-
|
53 |
-
f.write(file)
|
54 |
-
|
55 |
# Get the updated list of files
|
56 |
files = os.listdir(PDF_FOLDER)
|
57 |
return gr.Dropdown.update(choices=files), gr.Dropdown.update(choices=files)
|
|
|
9 |
import matplotlib.pyplot as plt
|
10 |
import matplotlib.patches as patches
|
11 |
import io
|
12 |
+
import shutil
|
13 |
# Initialize spaCy model
|
14 |
nlp = spacy.load('en_core_web_sm')
|
15 |
nlp.add_pipe('sentencizer')
|
|
|
50 |
if file is not None:
|
51 |
# Save the file to the upload directory
|
52 |
file_path = os.path.join(PDF_FOLDER, file.name)
|
53 |
+
shutil.copyfile(file.name, file_path)
|
|
|
|
|
54 |
# Get the updated list of files
|
55 |
files = os.listdir(PDF_FOLDER)
|
56 |
return gr.Dropdown.update(choices=files), gr.Dropdown.update(choices=files)
|