Spaces:
Runtime error
Runtime error
Chandan Dwivedi
commited on
Commit
·
d336524
1
Parent(s):
62ce07d
bugs fix and UI updates
Browse files- .streamlit/config.toml +4 -0
- README.md +3 -1
- app.py +11 -4
- requirements.txt +7 -4
.streamlit/config.toml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[theme]
|
2 |
+
backgroundColor="#0a3144"
|
3 |
+
secondaryBackgroundColor="#0f4d60"
|
4 |
+
textColor="#dedede"
|
README.md
CHANGED
@@ -4,9 +4,11 @@ emoji: ✉️
|
|
4 |
colorFrom: purple
|
5 |
colorTo: yellow
|
6 |
sdk: streamlit
|
7 |
-
sdk_version: 1.
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
4 |
colorFrom: purple
|
5 |
colorTo: yellow
|
6 |
sdk: streamlit
|
7 |
+
sdk_version: 1.25.0
|
8 |
+
python_version: 3.9
|
9 |
app_file: app.py
|
10 |
pinned: false
|
11 |
+
duplicated_from: loxzdigital/Model-CC-Space
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -14,6 +14,7 @@ import joblib
|
|
14 |
from bokeh.models.widgets import Div
|
15 |
|
16 |
import email
|
|
|
17 |
#from ipyfilechooser import FileChooser
|
18 |
|
19 |
#from IPython.display import display
|
@@ -22,7 +23,10 @@ from bs4 import BeautifulSoup
|
|
22 |
import matplotlib.pyplot as plt
|
23 |
import numpy as np
|
24 |
import timeit
|
|
|
25 |
|
|
|
|
|
26 |
|
27 |
def table_data():
|
28 |
# creating table data
|
@@ -179,7 +183,7 @@ def add_bg_from_url():
|
|
179 |
f"""
|
180 |
<style>
|
181 |
.stApp {{
|
182 |
-
background-image: linear-gradient(
|
183 |
background-attachment: fixed;
|
184 |
background-size: cover
|
185 |
|
@@ -262,6 +266,10 @@ target_variables = [
|
|
262 |
uploaded_file = st.file_uploader(
|
263 |
"Please upload your email (In HTML Format)", type=["html"])
|
264 |
|
|
|
|
|
|
|
|
|
265 |
if uploaded_file is None:
|
266 |
# upload_img = PIL.Image.open(uploaded_file)
|
267 |
upload_img = None
|
@@ -298,7 +306,6 @@ st.markdown("""---""")
|
|
298 |
def get_files_from_aws(bucket, prefix):
|
299 |
"""
|
300 |
get files from aws s3 bucket
|
301 |
-
|
302 |
bucket (STRING): bucket name
|
303 |
prefix (STRING): file location in s3 bucket
|
304 |
"""
|
@@ -323,6 +330,7 @@ if st.button('Generate Predictions'):
|
|
323 |
if uploaded_file is None:
|
324 |
st.error('Please upload a email (HTML format)')
|
325 |
else:
|
|
|
326 |
placeholder = st.empty()
|
327 |
placeholder.text('Loading Data')
|
328 |
|
@@ -488,5 +496,4 @@ if st.button('Generate Predictions'):
|
|
488 |
|
489 |
|
490 |
placeholder.empty()
|
491 |
-
#st.write(time.time() - start_time)
|
492 |
-
|
|
|
14 |
from bokeh.models.widgets import Div
|
15 |
|
16 |
import email
|
17 |
+
import os
|
18 |
#from ipyfilechooser import FileChooser
|
19 |
|
20 |
#from IPython.display import display
|
|
|
23 |
import matplotlib.pyplot as plt
|
24 |
import numpy as np
|
25 |
import timeit
|
26 |
+
import shutil
|
27 |
|
28 |
+
CURRENT_THEME = "blue"
|
29 |
+
IS_DARK_THEME = True
|
30 |
|
31 |
def table_data():
|
32 |
# creating table data
|
|
|
183 |
f"""
|
184 |
<style>
|
185 |
.stApp {{
|
186 |
+
background-image: linear-gradient(135deg,#061c2c,#084e69 35%,#3e7e89);
|
187 |
background-attachment: fixed;
|
188 |
background-size: cover
|
189 |
|
|
|
266 |
uploaded_file = st.file_uploader(
|
267 |
"Please upload your email (In HTML Format)", type=["html"])
|
268 |
|
269 |
+
def save_file(uploaded_file):
|
270 |
+
with open(os.path.join("./",uploaded_file.name),"wb") as f:
|
271 |
+
f.write(uploaded_file.getbuffer())
|
272 |
+
|
273 |
if uploaded_file is None:
|
274 |
# upload_img = PIL.Image.open(uploaded_file)
|
275 |
upload_img = None
|
|
|
306 |
def get_files_from_aws(bucket, prefix):
|
307 |
"""
|
308 |
get files from aws s3 bucket
|
|
|
309 |
bucket (STRING): bucket name
|
310 |
prefix (STRING): file location in s3 bucket
|
311 |
"""
|
|
|
330 |
if uploaded_file is None:
|
331 |
st.error('Please upload a email (HTML format)')
|
332 |
else:
|
333 |
+
save_file(uploaded_file)
|
334 |
placeholder = st.empty()
|
335 |
placeholder.text('Loading Data')
|
336 |
|
|
|
496 |
|
497 |
|
498 |
placeholder.empty()
|
499 |
+
#st.write(time.time() - start_time)
|
|
requirements.txt
CHANGED
@@ -1,11 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
bokeh==2.4.1
|
2 |
joblib
|
3 |
boto3
|
4 |
-
pandas
|
5 |
urlextract
|
6 |
-
scikit-learn==0.24.1
|
7 |
bs4
|
8 |
matplotlib
|
9 |
-
numpy
|
10 |
plotly
|
11 |
-
streamlit==1.
|
|
|
1 |
+
altair<5
|
2 |
+
pickle5
|
3 |
+
numpy
|
4 |
+
pandas
|
5 |
+
scikit-learn==0.24.1
|
6 |
+
Cython==0.29.36
|
7 |
bokeh==2.4.1
|
8 |
joblib
|
9 |
boto3
|
|
|
10 |
urlextract
|
|
|
11 |
bs4
|
12 |
matplotlib
|
|
|
13 |
plotly
|
14 |
+
streamlit==1.25.0
|