gopiashokan commited on
Commit
c35d3a5
·
verified ·
1 Parent(s): 4a9919a

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +16 -5
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,7 +1,8 @@
 
1
  import json
2
  import librosa
 
3
  import numpy as np
4
- import PIL.Image as Image
5
  import tensorflow as tf
6
  import streamlit as st
7
  from streamlit_extras.add_vertical_space import add_vertical_space
@@ -69,21 +70,31 @@ def prediction(audio_file):
69
  confidence = round(np.max(prediction)*100, 2)
70
 
71
  add_vertical_space(1)
72
- st.markdown(f'<h2 style="text-align: center; color: orange;">{confidence}% Match Found</h2>',
73
  unsafe_allow_html=True)
74
 
75
- st.markdown(f'<h2 style="text-align: center; color: green;">{predicted_class}</h2>',
 
 
 
 
 
 
 
 
 
 
76
  unsafe_allow_html=True)
77
 
78
 
79
 
80
 
81
- _, col2, _ = st.columns([0.1,0.9,0.1])
82
  with col2:
83
  input_audio = st.file_uploader(label='Upload the Audio', type=['mp3', 'wav'])
84
 
85
  if input_audio is not None:
86
 
87
- _, col2, _ = st.columns([0.2,0.8,0.2])
88
  with col2:
89
  prediction(input_audio)
 
1
+ import os
2
  import json
3
  import librosa
4
+ import cv2
5
  import numpy as np
 
6
  import tensorflow as tf
7
  import streamlit as st
8
  from streamlit_extras.add_vertical_space import add_vertical_space
 
70
  confidence = round(np.max(prediction)*100, 2)
71
 
72
  add_vertical_space(1)
73
+ st.markdown(f'<h4 style="text-align: center; color: orange;">{confidence}% Match Found</h4>',
74
  unsafe_allow_html=True)
75
 
76
+ # Display the Image
77
+ image_path = os.path.join('Inference_Images', f'{predicted_class}.jpg')
78
+ img = cv2.imread(image_path, cv2.IMREAD_COLOR)
79
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
80
+ img = cv2.resize(img, (350, 300))
81
+
82
+ _,col2,_ = st.columns([0.1,0.8,0.1])
83
+ with col2:
84
+ st.image(img)
85
+
86
+ st.markdown(f'<h3 style="text-align: center; color: green;">{predicted_class}</h3>',
87
  unsafe_allow_html=True)
88
 
89
 
90
 
91
 
92
+ _,col2,_ = st.columns([0.1,0.9,0.1])
93
  with col2:
94
  input_audio = st.file_uploader(label='Upload the Audio', type=['mp3', 'wav'])
95
 
96
  if input_audio is not None:
97
 
98
+ _,col2,_ = st.columns([0.2,0.8,0.2])
99
  with col2:
100
  prediction(input_audio)
requirements.txt CHANGED
@@ -1,6 +1,5 @@
1
  tensorflow
2
  opencv-python
3
- pillow
4
  numpy
5
  librosa
6
  streamlit
 
1
  tensorflow
2
  opencv-python
 
3
  numpy
4
  librosa
5
  streamlit