Spaces:
Runtime error
Runtime error
Commit
·
736353f
0
Parent(s):
init ui
Browse files- app.py +25 -0
- css/index.css +18 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import transformers
|
| 3 |
+
transformers.utils.move_cache()
|
| 4 |
+
from transformers import pipeline
|
| 5 |
+
p=pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
|
| 6 |
+
|
| 7 |
+
def asr_transcript_long(input_file):
|
| 8 |
+
print(type(p(input_file, chunk_length_s=10, stride_length_s=(2, 2))['text'].lower()))
|
| 9 |
+
return p(input_file, chunk_length_s=10, stride_length_s=(2, 2))['text'].lower()
|
| 10 |
+
|
| 11 |
+
with gr.Blocks(css = "css/index.css") as iface:
|
| 12 |
+
with gr.Row():
|
| 13 |
+
gr.Markdown(elem_id="logo" , value="")
|
| 14 |
+
with gr.Row():
|
| 15 |
+
# audio_input = gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Upload your audio file here")
|
| 16 |
+
audio_input = gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Upload your audio file here")
|
| 17 |
+
# audio_input = gr.Audio(source="mic")
|
| 18 |
+
|
| 19 |
+
btnPredict = gr.Button(elem_id="btn", value="Predict")
|
| 20 |
+
text_output = gr.Text()
|
| 21 |
+
btnSummerize = gr.Button(elem_id="btn", value="Summerize")
|
| 22 |
+
text_summerize = gr.Text()
|
| 23 |
+
btnPredict.click(fn=asr_transcript_long, inputs=audio_input, outputs=text_output)
|
| 24 |
+
# btnSummerize.click(fn=summerize, inputs=text_output, outputs=text_summerize)
|
| 25 |
+
iface.launch(debug=True)
|
css/index.css
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#logo {
|
| 2 |
+
margin-left: 40%
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
#btn {
|
| 6 |
+
color: green;
|
| 7 |
+
height: 30px;
|
| 8 |
+
width: auto;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.w1-full{
|
| 12 |
+
width: 50%;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
#img-id{
|
| 16 |
+
display: block;
|
| 17 |
+
margin-left: 40px;
|
| 18 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
tourch
|
| 4 |
+
tensorflow
|