File size: 874 Bytes
cab263c
 
1581bbf
cab263c
4affef3
 
 
cab263c
 
4affef3
cab263c
4affef3
42b403c
cab263c
a447a8b
9bb15cf
 
 
 
3c14b77
9bb15cf
 
 
 
4affef3
 
1581bbf
 
 
 
4affef3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# version - ArticMonkey:19.03.24:1743

import psutil

import numpy as np

import streamlit as st 
from audio2text.a2t import A2T
from audiorecorder import audiorecorder

audio = audiorecorder("Click to record", "Click to stop recording")

def main():
    if len(audio) > 0:
        st.audio(audio.export().read())  
        if st.button("Get text"):
            with st.spinner("Wait for it...."):
                a2t = A2T(audio)
                text = a2t.predict()
                print(text)
                st.write(text)
            st.success("Done")
        else:
            print("error")

if __name__ == "__main__":
    # Getting % usage of virtual_memory ( 3rd field)
    print('RAM memory % used:', psutil.virtual_memory()[2])
    # Getting usage of virtual_memory in GB ( 4th field)
    print('RAM Used (GB):', psutil.virtual_memory()[3]/1000000000)
    main()