Spaces:
Sleeping
Sleeping
Create app.py
Browse files# initializing the blueprint of the whole app
uploading the skeleton structure of the app with the placeholders to check how the app would like once uploaded.
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
def upload_file(files): # the actual translation should happen here
|
5 |
+
"""
|
6 |
+
takes the file that comes from the UI and converts it to the respective
|
7 |
+
format to be sent to the model for transcription
|
8 |
+
"""
|
9 |
+
# Define the column names
|
10 |
+
columns = ["audio_id", "transcribed_text( in org lang )", "transcribed_text( in eng )", "language"]
|
11 |
+
|
12 |
+
# Define the data as lists. Here the data would be sent in the form of single data fro mthe data
|
13 |
+
|
14 |
+
# data = [ ["ca_1.wav", "बिना किसी पूर्व सूचना के विलंबित या रद्द की गई ट्रिनिक", "without any prior information or any delay or delay in the train journey", "hindi"]]
|
15 |
+
|
16 |
+
|
17 |
+
# Create the DataFrameoutputs
|
18 |
+
df = pd.DataFrame(data, columns=columns)
|
19 |
+
|
20 |
+
return df
|
21 |
+
|
22 |
+
|
23 |
+
with gr.Blocks() as demo:
|
24 |
+
gr.Markdown( "# V2T Engine" )
|
25 |
+
with gr.Accordion("Steps to run the App"):
|
26 |
+
gr.Markdown("1. Click the \"Click to Upload a File\" to get the dialog box to browse your local path." )
|
27 |
+
gr.Markdown("2. The audio will get uploaded, transcribed into the ")
|
28 |
+
gr.Markdown("3. ")
|
29 |
+
|
30 |
+
upload_button = gr.UploadButton("Click to Upload a File", file_types=["audio"], file_count="single")
|
31 |
+
df_output = gr.Dataframe(
|
32 |
+
headers=["audio_id", "transcribed_text( in eng )", "transcribed_text( in org lang )", "language"],
|
33 |
+
datatype=["str", "str", "str"],
|
34 |
+
row_count=1,
|
35 |
+
col_count=(4, "fixed"),
|
36 |
+
)
|
37 |
+
upload_button.upload(upload_file, upload_button, df_output, show_progress = True) # upload the audio file and and sends to the upload function
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
if __name__ == "__main__":
|
42 |
+
demo.launch()
|