import gradio as gr import pandas as pd def upload_file(files): # the actual translation should happen here """ takes the file that comes from the UI and converts it to the respective format to be sent to the model for transcription """ # Define the column names columns = ["audio_id", "transcribed_text( in org lang )", "transcribed_text( in eng )", "language"] # Define the data as lists. Here the data would be sent in the form of single data fro mthe data # data = [ ["ca_1.wav", "बिना किसी पूर्व सूचना के विलंबित या रद्द की गई ट्रिनिक", "without any prior information or any delay or delay in the train journey", "hindi"]] # Create the DataFrameoutputs df = pd.DataFrame(data, columns=columns) return df with gr.Blocks() as demo: gr.Markdown( "# V2T Engine" ) with gr.Accordion("Steps to run the App"): gr.Markdown("1. Click the \"Click to Upload a File\" to get the dialog box to browse your local path." ) gr.Markdown("2. The audio will get uploaded, transcribed into the ") gr.Markdown("3. ") upload_button = gr.UploadButton("Click to Upload a File", file_types=["audio"], file_count="single") df_output = gr.Dataframe( headers=["audio_id", "transcribed_text( in eng )", "transcribed_text( in org lang )", "language"], datatype=["str", "str", "str"], row_count=1, col_count=(4, "fixed"), ) upload_button.upload(upload_file, upload_button, df_output, show_progress = True) # upload the audio file and and sends to the upload function if __name__ == "__main__": demo.launch()