Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""GradioASRdemo.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colab.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1OgSEOxvR1jUIG-aE0dQHXpr9-ODs63Ll
|
8 |
-
"""
|
9 |
-
|
10 |
-
!pip install -U gradio transformers librosa
|
11 |
-
|
12 |
-
import gradio as gr
|
13 |
-
import librosa
|
14 |
-
from transformers import AutoFeatureExtractor, AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
15 |
-
|
16 |
-
model_name1 = "openai/whisper-tiny"
|
17 |
-
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name1)
|
18 |
-
sampling_rate = feature_extractor.sampling_rate
|
19 |
-
asr = pipeline("automatic-speech-recognition", model=model_name1)
|
20 |
-
|
21 |
-
def speech_to_text(input_file):
|
22 |
-
transcribed_text = asr(input_file, chunk_length_s=30) #, chunk_length_s=30
|
23 |
-
return transcribed_text["text"]
|
24 |
-
|
25 |
-
transcribed_text = asr('/content/test.mp3')
|
26 |
-
transcribed_text
|
27 |
-
|
28 |
-
#inputs=gr.Audio(source="upload", type="filepath", label="Upload your audio")
|
29 |
-
inputs=gr.Audio(sources="upload", type="filepath", label="Upload Kannada audio file")
|
30 |
-
# outputs=gr.Textbox()
|
31 |
-
# examples = [["test1.wav"], ["test2.wav"]]
|
32 |
-
description = "Demo for Kannada ASR model "
|
33 |
-
|
34 |
-
gr.Interface(
|
35 |
-
speech_to_text,
|
36 |
-
inputs = inputs,
|
37 |
-
outputs = "text",
|
38 |
-
title="Kannada ASR model",
|
39 |
-
).launch()
|
40 |
-
# debug=True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|