Update app.py
Browse files
app.py
CHANGED
@@ -9,16 +9,16 @@ df = pd.read_csv("amasaku_data.tsv",sep='\t')
|
|
9 |
|
10 |
amasaku_mapping = {str(key).lower():str(val).lower() for key,val in zip(df.iloc[:,0],df.iloc[:,1])}
|
11 |
|
12 |
-
def transcribe(
|
13 |
|
14 |
#if not audio:
|
15 |
# return {state_var: state, transcription_var: state}
|
16 |
|
17 |
#print("filename: ",file)
|
18 |
-
print("microphone: ",microphone)
|
19 |
-
print("uploaded file: ",file)
|
20 |
if microphone:
|
21 |
-
file_name =
|
22 |
elif file:
|
23 |
file_name = file
|
24 |
try:
|
@@ -44,9 +44,9 @@ with gr.Blocks() as demo:
|
|
44 |
|
45 |
with gr.Row():
|
46 |
with gr.Column():
|
47 |
-
microphone = gr.Audio(sources="microphone", type="filepath", label="Microphone")
|
48 |
-
print("microphone source: ",microphone)
|
49 |
-
print(os.listdir("/tmp"))
|
50 |
uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath",sources="upload")
|
51 |
print('upload path: ',uploaded_audio)
|
52 |
with gr.Column():
|
@@ -56,7 +56,7 @@ with gr.Blocks() as demo:
|
|
56 |
|
57 |
transcribe_button.click(
|
58 |
transcribe,
|
59 |
-
[
|
60 |
transcription
|
61 |
)
|
62 |
|
|
|
9 |
|
10 |
amasaku_mapping = {str(key).lower():str(val).lower() for key,val in zip(df.iloc[:,0],df.iloc[:,1])}
|
11 |
|
12 |
+
def transcribe(file):
|
13 |
|
14 |
#if not audio:
|
15 |
# return {state_var: state, transcription_var: state}
|
16 |
|
17 |
#print("filename: ",file)
|
18 |
+
# print("microphone: ",microphone)
|
19 |
+
# print("uploaded file: ",file)
|
20 |
if microphone:
|
21 |
+
file_name = file
|
22 |
elif file:
|
23 |
file_name = file
|
24 |
try:
|
|
|
44 |
|
45 |
with gr.Row():
|
46 |
with gr.Column():
|
47 |
+
# microphone = gr.Audio(sources="microphone", type="filepath", label="Microphone")
|
48 |
+
# print("microphone source: ",microphone)
|
49 |
+
# print(os.listdir("/tmp"))
|
50 |
uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath",sources="upload")
|
51 |
print('upload path: ',uploaded_audio)
|
52 |
with gr.Column():
|
|
|
56 |
|
57 |
transcribe_button.click(
|
58 |
transcribe,
|
59 |
+
[uploaded_audio],
|
60 |
transcription
|
61 |
)
|
62 |
|