AbdullaShafeeg commited on
Commit
0c0344f
·
1 Parent(s): 8cd428d

big update

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -12,6 +12,7 @@ from scipy.io import wavfile
12
  import pydub
13
  import time
14
  import os
 
15
 
16
  # MODEL LOADING and INITIALISATION
17
  model = torch.jit.load("snorenetv1_small.ptl")
@@ -61,28 +62,28 @@ if uploaded_file is not None:
61
 
62
  # PERCENTAGE OF SNORING PLOT
63
 
64
- filename = uploaded_file.name
65
- cwdir = os.getcwd()
66
- file_path = os.path.join(cwdir, filename)
67
 
68
- if os.path.exists(file_path):
69
- total = snore + other
70
- snore_percentage = (snore / total) * 100
71
- other_percentage = (other / total) * 100
72
 
73
- categories = ["Snore", "Other"]
74
- percentages = [snore_percentage, other_percentage]
75
 
76
- plt.figure(figsize=(8, 4))
77
- plt.barh(categories, percentages, color=['#ff0033', '#00ffee'])
78
- plt.xlabel('Percentage')
79
- plt.title('Percentage of Snoring')
80
- plt.xlim(0, 100)
81
 
82
- for i, percentage in enumerate(percentages):
83
- plt.text(percentage, i, f' {percentage:.2f}%', va='center')
84
- st.write("DONE")
85
- st.pyplot(plt)
86
 
87
 
88
 
 
12
  import pydub
13
  import time
14
  import os
15
+ import atexit
16
 
17
  # MODEL LOADING and INITIALISATION
18
  model = torch.jit.load("snorenetv1_small.ptl")
 
62
 
63
  # PERCENTAGE OF SNORING PLOT
64
 
65
+ filename = uploaded_file.name
66
+ cwdir = os.getcwd()
67
+ file_path = os.path.join(cwdir, filename)
68
 
69
+ if os.path.exists(file_path):
70
+ total = snore + other
71
+ snore_percentage = (snore / total) * 100
72
+ other_percentage = (other / total) * 100
73
 
74
+ categories = ["Snore", "Other"]
75
+ percentages = [snore_percentage, other_percentage]
76
 
77
+ plt.figure(figsize=(8, 4))
78
+ plt.barh(categories, percentages, color=['#ff0033', '#00ffee'])
79
+ plt.xlabel('Percentage')
80
+ plt.title('Percentage of Snoring')
81
+ plt.xlim(0, 100)
82
 
83
+ for i, percentage in enumerate(percentages):
84
+ plt.text(percentage, i, f' {percentage:.2f}%', va='center')
85
+ st.write("DONE")
86
+ st.pyplot(plt)
87
 
88
 
89