awacke1 commited on
Commit
f292f6f
·
1 Parent(s): cba740f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -1,16 +1,23 @@
1
- import streamlit as st
 
 
2
 
3
- st.write('https://huggingface.co/spaces/awacke1/Hackathon2022/')
4
 
5
- import streamlit as st
 
 
 
 
6
 
7
- @st.experimental_singleton
8
- def get_everyone_session():
9
-
10
- # This is for good - til container reboots.
11
- DB_URL = "https://huggingface.co/spaces/awacke1/Hackathon2022"
12
- engine = create_engine(DB_URL)
13
- db_EditUrl = "https://huggingface.co/spaces/awacke1/Hackathon2022/edit/main/app.py"
14
- return sessionmaker(engine)
15
-
16
- dbsm = get_db_sessionmaker()
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+ import time
4
 
5
+ p = pipeline("automatic-speech-recognition")
6
 
7
+ def transcribe(audio, state=""):
8
+ time.sleep(5)
9
+ text = p(audio)["text"]
10
+ state += text + " "
11
+ return state, state
12
 
13
+ gr.Interface(
14
+ fn=transcribe,
15
+ inputs=[
16
+ gr.inputs.Audio(source="microphone", type="filepath"),
17
+ "state"
18
+ ],
19
+ outputs=[
20
+ "textbox",
21
+ "state"
22
+ ],
23
+ live=True).launch()