Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,10 @@ def predict_class(text):
|
|
28 |
st.error(f"Error during prediction: {e}")
|
29 |
return None
|
30 |
|
|
|
|
|
|
|
|
|
31 |
st.title("Paper Citation Classifier")
|
32 |
|
33 |
option = st.radio("Select input type:", ("Text", "PDF"))
|
@@ -51,7 +55,7 @@ elif option == "PDF":
|
|
51 |
uploaded_file = st.file_uploader("Upload a PDF file", type=["pdf"])
|
52 |
|
53 |
if uploaded_file is not None:
|
54 |
-
file_path = os.path.join(
|
55 |
with open(file_path, "wb") as f:
|
56 |
f.write(uploaded_file.getbuffer())
|
57 |
st.success("File uploaded successfully.")
|
|
|
28 |
st.error(f"Error during prediction: {e}")
|
29 |
return None
|
30 |
|
31 |
+
# Create a directory to store uploaded files
|
32 |
+
uploaded_files_dir = "uploaded_files"
|
33 |
+
os.makedirs(uploaded_files_dir, exist_ok=True)
|
34 |
+
|
35 |
st.title("Paper Citation Classifier")
|
36 |
|
37 |
option = st.radio("Select input type:", ("Text", "PDF"))
|
|
|
55 |
uploaded_file = st.file_uploader("Upload a PDF file", type=["pdf"])
|
56 |
|
57 |
if uploaded_file is not None:
|
58 |
+
file_path = os.path.join(uploaded_files_dir, uploaded_file.name)
|
59 |
with open(file_path, "wb") as f:
|
60 |
f.write(uploaded_file.getbuffer())
|
61 |
st.success("File uploaded successfully.")
|