Spaces:
Runtime error
Runtime error
marcelomoreno26
commited on
Commit
•
6b119d2
1
Parent(s):
620df1b
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,15 @@ from model_functions import *
|
|
2 |
from preprocessor import *
|
3 |
import streamlit as st
|
4 |
import pandas as pd
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
def main():
|
@@ -22,9 +30,10 @@ def main():
|
|
22 |
"Example 2": "example2.zip",
|
23 |
"Example 3": "example3.zip"
|
24 |
}
|
|
|
25 |
for name, file in example_files.items():
|
26 |
-
|
27 |
-
|
28 |
|
29 |
|
30 |
# File uploader
|
|
|
2 |
from preprocessor import *
|
3 |
import streamlit as st
|
4 |
import pandas as pd
|
5 |
+
from streamlit.hashing import _CodeHasher
|
6 |
|
7 |
+
# Create a hasher object
|
8 |
+
hasher = _CodeHasher()
|
9 |
+
|
10 |
+
@st.cache_data(hash_funcs={Streamlit: lambda x: hasher(x.write)})
|
11 |
+
def load_example_file(file):
|
12 |
+
with open(file, "rb") as f:
|
13 |
+
return f.read()
|
14 |
|
15 |
|
16 |
def main():
|
|
|
30 |
"Example 2": "example2.zip",
|
31 |
"Example 3": "example3.zip"
|
32 |
}
|
33 |
+
|
34 |
for name, file in example_files.items():
|
35 |
+
data = load_example_file(file)
|
36 |
+
st.download_button(label=name, data=data, file_name=file, mime="application/zip")
|
37 |
|
38 |
|
39 |
# File uploader
|