barbaroo commited on
Commit
93c12ab
·
verified ·
1 Parent(s): 2e0c6c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -39,10 +39,10 @@ def transcribe_function(audio, state, uploaded_audio, m3u8_url):
39
  state += text + "\n"
40
  return {state_var: state, transcription_var: state}
41
  except Exception as e:
42
- return {transcription_var: "An error occurred during transcription.", state_var: state} # Handle other exceptions
43
 
44
  def reset_output(transcription, state):
45
- """Function to reset the state to an empty string."""
46
  return "", ""
47
 
48
  with gr.Blocks() as demo:
@@ -50,14 +50,14 @@ with gr.Blocks() as demo:
50
 
51
  with gr.Row():
52
  with gr.Column():
53
- # Remove "source" parameter. The component now supports microphone recording automatically.
54
  microphone = gr.Audio(type="filepath", label="Microphone")
55
- # Remove "source" parameter for the uploaded audio as well.
56
  uploaded_audio = gr.Audio(type="filepath", label="Upload Audio File")
57
  m3u8_url = gr.Textbox(label="m3u8 URL | E.g.: from kvf.fo or logting.fo")
58
 
59
  with gr.Column():
60
- transcription_var = gr.Textbox(type="text", label="Transcription", readonly=True)
 
61
 
62
  with gr.Row():
63
  transcribe_button = gr.Button("Transcribe")
@@ -76,3 +76,4 @@ with gr.Blocks() as demo:
76
  )
77
 
78
  demo.launch()
 
 
39
  state += text + "\n"
40
  return {state_var: state, transcription_var: state}
41
  except Exception as e:
42
+ return {transcription_var: "An error occurred during transcription.", state_var: state}
43
 
44
  def reset_output(transcription, state):
45
+ """Reset the state to an empty string."""
46
  return "", ""
47
 
48
  with gr.Blocks() as demo:
 
50
 
51
  with gr.Row():
52
  with gr.Column():
53
+ # The "source" parameter has been removed in the latest Gradio version.
54
  microphone = gr.Audio(type="filepath", label="Microphone")
 
55
  uploaded_audio = gr.Audio(type="filepath", label="Upload Audio File")
56
  m3u8_url = gr.Textbox(label="m3u8 URL | E.g.: from kvf.fo or logting.fo")
57
 
58
  with gr.Column():
59
+ # Replace 'readonly=True' with 'interactive=False' to create a read-only textbox.
60
+ transcription_var = gr.Textbox(type="text", label="Transcription", interactive=False)
61
 
62
  with gr.Row():
63
  transcribe_button = gr.Button("Transcribe")
 
76
  )
77
 
78
  demo.launch()
79
+