Commit
·
b42b2a5
1
Parent(s):
d9019d1
Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,15 @@ import re
|
|
11 |
|
12 |
model = whisper.load_model("tiny")
|
13 |
|
14 |
-
def compress_audio(file_path, bitrate='32k'):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
def url_to_text(url):
|
25 |
if url != '':
|
@@ -35,7 +35,7 @@ def url_to_text(url):
|
|
35 |
base, ext = os.path.splitext(out_file)
|
36 |
os.rename(out_file, base+'.mp3')
|
37 |
file_path = base+'.mp3'
|
38 |
-
compress_audio(file_path)
|
39 |
|
40 |
result = model.transcribe(file_path)
|
41 |
return result['text'].strip()
|
@@ -52,7 +52,7 @@ with gr.Blocks() as demo:
|
|
52 |
gr.Markdown("<h1>Samir's AI Model Implementation - Automatic Speech Recognition</h1>")
|
53 |
gr.Markdown("<h2>YouTube Audio AutoTranscribe: Effortless Transcription</h2>")
|
54 |
gr.Markdown("<b>This application is using <a href=https://openai.com/blog/whisper/ target=_blank>OpenAI's Whisper</a>. Whisper is an intricately designed <br>neural network aiming to achieve the highest precision in the field of multilingual speech recognition.</b>")
|
55 |
-
gr.Markdown("<b>The time for the model to perform transcription typically takes around
|
56 |
|
57 |
input_text_url = gr.Textbox(placeholder='Youtube Video URL', label='👇YouTube URL👇')
|
58 |
result_button_transcribe = gr.Button('Transcribe Now')
|
|
|
11 |
|
12 |
model = whisper.load_model("tiny")
|
13 |
|
14 |
+
# def compress_audio(file_path, bitrate='32k'):
|
15 |
+
# try:
|
16 |
+
# audio = AudioSegment.from_file(file_path)
|
17 |
+
# output_format = os.path.splitext(file_path)[1][1:]
|
18 |
+
# compressed_audio = audio.export(file_path, format=output_format, bitrate=bitrate)
|
19 |
+
# return True
|
20 |
+
# except Exception as e:
|
21 |
+
# print(f"Error: {e}")
|
22 |
+
# return False
|
23 |
|
24 |
def url_to_text(url):
|
25 |
if url != '':
|
|
|
35 |
base, ext = os.path.splitext(out_file)
|
36 |
os.rename(out_file, base+'.mp3')
|
37 |
file_path = base+'.mp3'
|
38 |
+
# compress_audio(file_path)
|
39 |
|
40 |
result = model.transcribe(file_path)
|
41 |
return result['text'].strip()
|
|
|
52 |
gr.Markdown("<h1>Samir's AI Model Implementation - Automatic Speech Recognition</h1>")
|
53 |
gr.Markdown("<h2>YouTube Audio AutoTranscribe: Effortless Transcription</h2>")
|
54 |
gr.Markdown("<b>This application is using <a href=https://openai.com/blog/whisper/ target=_blank>OpenAI's Whisper</a>. Whisper is an intricately designed <br>neural network aiming to achieve the highest precision in the field of multilingual speech recognition.</b>")
|
55 |
+
gr.Markdown("<b>The time for the model to perform transcription typically takes around 15 seconds for every 1 minute of video. <br>For example, a 10-minute video would take approximately 150 seconds to transcribe the audio content.</b>")
|
56 |
|
57 |
input_text_url = gr.Textbox(placeholder='Youtube Video URL', label='👇YouTube URL👇')
|
58 |
result_button_transcribe = gr.Button('Transcribe Now')
|