Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,9 +73,12 @@ def main():
|
|
| 73 |
if uploaded_file is not None:
|
| 74 |
if st.button("Summarize"):
|
| 75 |
col1, col2 = st.columns(2)
|
| 76 |
-
|
| 77 |
-
with
|
| 78 |
temp_file.write(uploaded_file.read())
|
|
|
|
|
|
|
|
|
|
| 79 |
with col1:
|
| 80 |
st.info("Uploaded File")
|
| 81 |
pdf_view = displayPDF(filepath)
|
|
@@ -84,6 +87,9 @@ def main():
|
|
| 84 |
summary = llm_pipeline(filepath)
|
| 85 |
st.info("Summarization Complete")
|
| 86 |
st.success(summary)
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
|
|
|
|
| 73 |
if uploaded_file is not None:
|
| 74 |
if st.button("Summarize"):
|
| 75 |
col1, col2 = st.columns(2)
|
| 76 |
+
# Use a temporary filename directly
|
| 77 |
+
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
| 78 |
temp_file.write(uploaded_file.read())
|
| 79 |
+
temp_file.flush() # Ensure contents are written to disk
|
| 80 |
+
filepath = temp_file.name
|
| 81 |
+
|
| 82 |
with col1:
|
| 83 |
st.info("Uploaded File")
|
| 84 |
pdf_view = displayPDF(filepath)
|
|
|
|
| 87 |
summary = llm_pipeline(filepath)
|
| 88 |
st.info("Summarization Complete")
|
| 89 |
st.success(summary)
|
| 90 |
+
# Clean up the temporary file
|
| 91 |
+
os.remove(filepath)
|
| 92 |
+
|
| 93 |
|
| 94 |
|
| 95 |
|