Scripting Audio Conversations (part 2) - User Files Upload with Google SpeechToText and Python Dash
Hello Everyone! My name is Andrew Fung, in this video, I will be showing you how you can upload an audio conversation file and get the transcription of using Google’s Speech-To-Text API and display the script on the web using Python Dash. In this second part of the video, we will be focusing on allowing users to input multiple audio files and displaying the transcription results on the website.
#speechtotext #googlecloud #speakerdiarization #python #dash
#speakerdetection
Installation and Setup!
Google Speech to Text:
https://cloud.google.com/support-hub
https://cloud.google.com/speech-to-text/docs/multiple-voices
Dash documentation: https://dash.plotly.com/dash-core-com...
Source code for this project:
https://github.com/Andrew-FungKinHo/YouTube/tree/main/Multiple%20Speaker%20Detection
Check out my Github!
https://github.com/Andrew-FungKinHo
How I make my YouTube videos:
⌨️ Keyboard - Nuphy Air75 Mechanical Keyboard - https://amzn.to/3Xu4PD3
? Microphone - MAONO A04 Professional Podcaster USB Microphone - https://amzn.to/3k8ocD5
? Mouse - Microsoft Bluetooth Ergonomic Mouse - https://amzn.to/3CHhdHJ
? Accessories - Laptop Docking Station for MacBook Pro - https://amzn.to/3CHi5Mv
Timestamps
0:00 | Intro
1:18 | Get transcript function
2:47 | Dash app script
15:10 | Out tro
Full code:
———————————————————————————————
from speaker import get_transcript
import datetime
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
# intial layout
app.layout = html.Div([
dcc.Upload(
id='upload-image',
children=html.Div([
'Drag and Drop or ',
html.A('Select Files')
]),
style={
'width': '100%',
'height': '60px',
'lineHeight': '60px',
'borderWidth': '1px',
'borderStyle': 'dashed',
'borderRadius': '5px',
'textAlign': 'center',
'margin': '10px'
},
# Allow multiple files to be uploaded
multiple=True
),
html.Div(id='output-image-upload'),
])
# layout after an upload is detected
def parse_contents(contents, filename, date):
if contents is not None:
content_type, content_string = contents.split(',')
script = get_transcript(filename,content_type)
return html.Div([
html.H5(filename),
html.H6(datetime.datetime.fromtimestamp(date)),
html.Audio(id="player",src=contents,controls=True,style={"width": "50%"}),
html.Hr(),
html.Div('Transcript'),
html.Plaintext(script),
])
@app.callback(Output('output-image-upload', 'children'),
Input('upload-image', 'contents'),
State('upload-image', 'filename'),
State('upload-image', 'last_modified'))
def update_output(list_of_contents, list_of_names, list_of_dates):
if list_of_contents is not None:
children = [
parse_contents(c, n, d) for c, n, d in
zip(list_of_contents, list_of_names, list_of_dates)]
return children
if __name__ == '__main__':
app.run_server(debug=True)
———————————————————————————————
Feel free to drop a like and comment if you enjoy and video and let me know if you want me to do other types of programming videos ;) !!!
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Scripting Audio Conversations (part 2) - User Files Upload with Google SpeechToText and Python Dash», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.