from difflib import Differ import gradio as gr import torch from transformers import ( AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline, ) # diction_text = """ # How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon? which hold out seductions somewhat more dangerous, methinks, to honest labor than those presented by a library; or in listless inaction, in weary unoccupied solitude? That cannot be. While man is a social animal society he must have, and better a thousand times that he should seek relief from the tedium of unemployed hours in the improving conversation of worthy authors, dead or living, than in the debasing, brutalising communications from which it is so difficult otherwise to escape. # """ diction_text = """ How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon? which hold out seductions somewhat more dangerous, methinks, to honest labor than those presented by a library """ diction_script = gr.Textbox(diction_text, interactive=False, show_label=False) device = "cpu" torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32 # model_id = "openai/whisper-base " model_id = "openai/whisper-large-v3" description = f"""
Welcome to redmond Barryoke! This app aims to demonstrate the potential of using machine learning to transcribe audio.
The app invites users to record themselves reading an brief and abridged excerpt from a speech delivered by Redmond Barry at the opening of The Free Public Library of Ballarat Est in 1869. Once recorded and submitted the app will transcribe and return a "diction" score.
This app uses {model_id} to power it's automated transcription