ZennyKenny commited on
Commit
781e9f1
·
verified ·
1 Parent(s): db3a36a

handle mic crash

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -67,12 +67,18 @@ def main():
67
  print(f"Error in process_audio: {e}")
68
  return f"Error processing audio: {e}", ""
69
 
 
 
 
 
 
70
  with gr.Blocks() as interface:
71
  with gr.Row():
72
  with gr.Column():
73
  # Enable recording or file upload
74
  audio_input = gr.Audio(type="numpy", label="Record or Upload Audio")
75
  process_button = gr.Button("Process Audio")
 
76
  with gr.Column():
77
  transcription_output = gr.Textbox(label="Full Transcription", lines=10)
78
  summary_output = gr.Textbox(label="Summary", lines=5)
@@ -83,6 +89,12 @@ def main():
83
  outputs=[transcription_output, summary_output]
84
  )
85
 
 
 
 
 
 
 
86
  interface.launch(share=True)
87
 
88
  if __name__ == "__main__":
 
67
  print(f"Error in process_audio: {e}")
68
  return f"Error processing audio: {e}", ""
69
 
70
+ def stop_microphone():
71
+ """Simulate stopping the microphone."""
72
+ print("Microphone stopped.") # Debugging for user feedback
73
+ return "Microphone stopped. Recording session has ended."
74
+
75
  with gr.Blocks() as interface:
76
  with gr.Row():
77
  with gr.Column():
78
  # Enable recording or file upload
79
  audio_input = gr.Audio(type="numpy", label="Record or Upload Audio")
80
  process_button = gr.Button("Process Audio")
81
+ stop_button = gr.Button("Stop Recording") # Add Stop Button
82
  with gr.Column():
83
  transcription_output = gr.Textbox(label="Full Transcription", lines=10)
84
  summary_output = gr.Textbox(label="Summary", lines=5)
 
89
  outputs=[transcription_output, summary_output]
90
  )
91
 
92
+ stop_button.click(
93
+ stop_microphone,
94
+ inputs=[],
95
+ outputs=[]
96
+ )
97
+
98
  interface.launch(share=True)
99
 
100
  if __name__ == "__main__":