File size: 1,020 Bytes
1726dba
065ecac
1726dba
fa6f424
071265e
 
bcfb814
5cc4f06
5767b04
 
d7e888d
071265e
d7e888d
bcfb814
c5cb357
 
5cc4f06
c5cb357
5cc4f06
071265e
2906c35
c5cb357
5cc4f06
071265e
5cc4f06
071265e
 
 
5cc4f06
 
43c8625
5cc4f06
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
32
import streamlit as st
from st_audiorec import st_audiorec

from nameder import init_model_ner, get_entity_labels
from speech2text import init_model_trans, transcribe
from resources import audit_elapsedtime, set_start

def main ():
    print("------------------------------")
    print(f"Running main")

    s2t = init_model_trans()
    ner = init_model_ner() #async

    print("Rendering UI...")
    start_render = set_start()
    wav_audio_data = st_audiorec()
    audit_elapsedtime(function="Rendering UI", start=start_render)

    if wav_audio_data is not None and s2t is not None:
        print("Loading data...")
        start_loading = set_start()
        st.audio(wav_audio_data, format='audio/wav')
        text = transcribe(wav_audio_data, s2t)

        if text is not None and ner is not None:    
            st.write('Entities: ', get_entity_labels(model=ner, text=text))
        audit_elapsedtime(function="Loading data", start=start_loading)

if __name__ == "__main__":
    print("IN __name__")
    main()