Spaces:
Runtime error
Runtime error
added support to save file locally on streamlite demo
Browse files
app.py
CHANGED
|
@@ -263,8 +263,9 @@ target_variables = [
|
|
| 263 |
uploaded_file = st.file_uploader(
|
| 264 |
"Please upload your email (In HTML Format)", type=["html"])
|
| 265 |
|
| 266 |
-
|
| 267 |
-
|
|
|
|
| 268 |
|
| 269 |
if uploaded_file is None:
|
| 270 |
# upload_img = PIL.Image.open(uploaded_file)
|
|
@@ -326,6 +327,7 @@ if st.button('Generate Predictions'):
|
|
| 326 |
if uploaded_file is None:
|
| 327 |
st.error('Please upload a email (HTML format)')
|
| 328 |
else:
|
|
|
|
| 329 |
placeholder = st.empty()
|
| 330 |
placeholder.text('Loading Data')
|
| 331 |
|
|
|
|
| 263 |
uploaded_file = st.file_uploader(
|
| 264 |
"Please upload your email (In HTML Format)", type=["html"])
|
| 265 |
|
| 266 |
+
def save_file(uploaded_file):
|
| 267 |
+
with open(os.path.join("./",uploaded_file.name),"wb") as f:
|
| 268 |
+
f.write(uploaded_file.getbuffer())
|
| 269 |
|
| 270 |
if uploaded_file is None:
|
| 271 |
# upload_img = PIL.Image.open(uploaded_file)
|
|
|
|
| 327 |
if uploaded_file is None:
|
| 328 |
st.error('Please upload a email (HTML format)')
|
| 329 |
else:
|
| 330 |
+
save_file(uploaded_file)
|
| 331 |
placeholder = st.empty()
|
| 332 |
placeholder.text('Loading Data')
|
| 333 |
|