Soham98 commited on
Commit
73031f3
·
verified ·
1 Parent(s): 9fcf1a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -47,7 +47,7 @@ file_transcribe = gr.Interface(
47
 
48
  # Choices are presented as the model expects. The language codes are provded in "Languages in FLORES-200" in the link below
49
  #https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200
50
-
51
  # Create the demo with tabbed interfaces
52
  demo = gr.Blocks()
53
 
@@ -57,6 +57,15 @@ with demo:
57
  ["Transcribe Microphone", "Transcribe Audio File"],
58
  )
59
 
 
 
 
60
  # Launch the Gradio demo
61
  if __name__ == "__main__":
 
 
 
 
 
 
62
  demo.launch()
 
47
 
48
  # Choices are presented as the model expects. The language codes are provded in "Languages in FLORES-200" in the link below
49
  #https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200
50
+ import threading
51
  # Create the demo with tabbed interfaces
52
  demo = gr.Blocks()
53
 
 
57
  ["Transcribe Microphone", "Transcribe Audio File"],
58
  )
59
 
60
+ def stop_demo():
61
+ global demo
62
+ demo.close()
63
  # Launch the Gradio demo
64
  if __name__ == "__main__":
65
+ # Set the duration (in seconds) after which the demo should stop
66
+ duration = 300 # 5 min
67
+ # Start the timer
68
+ threading.Timer(duration, stop_demo).start()
69
+
70
+ # Launch the demo
71
  demo.launch()