anuragshas commited on
Commit
8728339
·
1 Parent(s): 5faea4d

update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -3,7 +3,6 @@ import torch
3
  import gradio as gr
4
  import pytube as pt
5
  from transformers import pipeline
6
- from huggingface_hub import model_info
7
 
8
  MODEL_NAME = "anuragshas/whisper-large-v2-hi"
9
  lang = "hi"
@@ -61,8 +60,8 @@ demo = gr.Blocks()
61
  mf_transcribe = gr.Interface(
62
  fn=transcribe,
63
  inputs=[
64
- gr.inputs.Audio(source="microphone", type="filepath", optional=True),
65
- gr.inputs.Audio(source="upload", type="filepath", optional=True),
66
  ],
67
  outputs="text",
68
  layout="horizontal",
@@ -73,25 +72,23 @@ mf_transcribe = gr.Interface(
73
  f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
74
  " of arbitrary length."
75
  ),
76
- allow_flagging="never",
77
  )
78
 
79
  yt_transcribe = gr.Interface(
80
  fn=yt_transcribe,
81
- inputs=[gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL")],
82
  outputs=["html", "text"],
83
- layout="horizontal",
84
- theme="huggingface",
85
  title="Whisper Demo: Transcribe YouTube",
86
  description=(
87
  "Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
88
  f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
89
  " arbitrary length."
90
  ),
91
- allow_flagging="never",
92
  )
93
 
94
  with demo:
95
  gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
96
 
97
- demo.launch(enable_queue=True)
 
3
  import gradio as gr
4
  import pytube as pt
5
  from transformers import pipeline
 
6
 
7
  MODEL_NAME = "anuragshas/whisper-large-v2-hi"
8
  lang = "hi"
 
60
  mf_transcribe = gr.Interface(
61
  fn=transcribe,
62
  inputs=[
63
+ gr.Audio(sources="microphone", type="filepath"),
64
+ gr.Audio(sources="upload", type="filepath"),
65
  ],
66
  outputs="text",
67
  layout="horizontal",
 
72
  f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
73
  " of arbitrary length."
74
  ),
75
+ flagging_mode="never",
76
  )
77
 
78
  yt_transcribe = gr.Interface(
79
  fn=yt_transcribe,
80
+ inputs=[gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL")],
81
  outputs=["html", "text"],
 
 
82
  title="Whisper Demo: Transcribe YouTube",
83
  description=(
84
  "Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
85
  f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
86
  " arbitrary length."
87
  ),
88
+ flagging_mode="never",
89
  )
90
 
91
  with demo:
92
  gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
93
 
94
+ demo.launch(mcp_server=True, show_api=False)