Spaces:
Sleeping
Sleeping
mindexplorer
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -30,21 +30,32 @@ def stream_data(value1,path,value2):
|
|
30 |
for word in value2.split(" "):
|
31 |
yield word + " "
|
32 |
time.sleep(0.02)
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<style>
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
background-position: center;
|
39 |
-
background-repeat: no-repeat;
|
40 |
}
|
41 |
</style>
|
42 |
-
|
43 |
|
44 |
-
st.markdown(
|
45 |
-
|
46 |
-
disease_classes = ['COPD','Healthy', 'Other']
|
47 |
|
|
|
48 |
|
49 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
50 |
processor = AutoProcessor.from_pretrained("MIT/ast-finetuned-audioset-10-10-0.4593")
|
|
|
30 |
for word in value2.split(" "):
|
31 |
yield word + " "
|
32 |
time.sleep(0.02)
|
33 |
+
|
34 |
+
|
35 |
+
disease_classes = ['COPD','Healthy', 'Other']
|
36 |
+
import base64
|
37 |
+
|
38 |
+
@st.cache(allow_output_mutation=True)
|
39 |
+
def get_base64_of_bin_file(bin_file):
|
40 |
+
with open(bin_file, 'rb') as f:
|
41 |
+
data = f.read()
|
42 |
+
return base64.b64encode(data).decode()
|
43 |
+
|
44 |
+
def set_png_as_page_bg(png_file):
|
45 |
+
bin_str = get_base64_of_bin_file(png_file)
|
46 |
+
page_bg_img = '''
|
47 |
<style>
|
48 |
+
body {
|
49 |
+
background-image: url("data:image/jpg;base64,%s");
|
50 |
+
background-size: cover;
|
|
|
|
|
51 |
}
|
52 |
</style>
|
53 |
+
''' % bin_str
|
54 |
|
55 |
+
st.markdown(page_bg_img, unsafe_allow_html=True)
|
56 |
+
return
|
|
|
57 |
|
58 |
+
set_png_as_page_bg('Assests/cover.jpg')
|
59 |
|
60 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
61 |
processor = AutoProcessor.from_pretrained("MIT/ast-finetuned-audioset-10-10-0.4593")
|