AbdullaShafeeg commited on
Commit
9ca3c5c
·
1 Parent(s): 0c0344f

big update

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -46,7 +46,6 @@ if uploaded_file is not None:
46
  time.sleep(2)
47
  st.write("File Saved!")
48
 
49
- st.write("Analysing...")
50
  while(endReached==False):
51
  sr, waveform = wavfile.read(uploaded_file.name)
52
  input_tensor = torch.tensor(waveform[s:n]).unsqueeze(0).to(torch.float32)
@@ -66,27 +65,27 @@ if uploaded_file is not None:
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
-
90
-
91
-
92
 
 
46
  time.sleep(2)
47
  st.write("File Saved!")
48
 
 
49
  while(endReached==False):
50
  sr, waveform = wavfile.read(uploaded_file.name)
51
  input_tensor = torch.tensor(waveform[s:n]).unsqueeze(0).to(torch.float32)
 
65
  cwdir = os.getcwd()
66
  file_path = os.path.join(cwdir, filename)
67
 
68
+ if st.button("Analyse"):
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
 
 
 
 
 
89
 
90
 
 
 
 
91