camparchimedes commited on
Commit
23d2264
·
verified ·
1 Parent(s): 1a0450c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -48,7 +48,7 @@ def transcribe_audio(audio_file):
48
  forced_decoder_ids = processor.get_decoder_prompt_ids(language=language, task=task)
49
 
50
  with torch.no_grad():
51
- # CUDA@function -->
52
  with torch.cuda.device(device) if torch.cuda.is_available() else contextlib.nullcontext():
53
  output = pipe(audio_file, chunk_length_s=30, generate_kwargs={"forced_decoder_ids": forced_decoder_ids})
54
 
@@ -187,6 +187,13 @@ def text_rank_summary(text, num_paragraphs=3):
187
  return ' '.join(summary)
188
 
189
 
 
 
 
 
 
 
 
190
  import gradio as gr
191
  from fpdf import FPDF
192
  from PIL import Image
@@ -209,17 +216,12 @@ def save_to_pdf(text, summary):
209
  pdf.output(pdf_output_path)
210
  return pdf_output_path
211
 
212
- banner_html = """
213
- <div style="text-align: center;">
214
- <img src="https://huggingface.co/spaces/camparchimedes/transcription_app/resolve/main/Olas%20AudioSwitch%20Shop.png" alt="Banner Image" width="100%" height="auto">
215
- </div>
216
- """
217
 
218
 
219
  iface = gr.Interface(
220
  fn=transcribe_audio,
221
  inputs=gr.Audio(type="filepath"),
222
- outputs=gr.Textbox(label="Transcription"),
223
  title="SW Transcription App",
224
  description="Upload an audio file to get the text",
225
  theme="default",
 
48
  forced_decoder_ids = processor.get_decoder_prompt_ids(language=language, task=task)
49
 
50
  with torch.no_grad():
51
+ # CUDA@function -->
52
  with torch.cuda.device(device) if torch.cuda.is_available() else contextlib.nullcontext():
53
  output = pipe(audio_file, chunk_length_s=30, generate_kwargs={"forced_decoder_ids": forced_decoder_ids})
54
 
 
187
  return ' '.join(summary)
188
 
189
 
190
+ banner_html = """
191
+ <div style="text-align: center;">
192
+ <img src="https://huggingface.co/spaces/camparchimedes/transcription_app/resolve/main/Olas%20AudioSwitch%20Shop.png" alt="Banner Image" width="100%" height="auto">
193
+ </div>
194
+ """
195
+
196
+
197
  import gradio as gr
198
  from fpdf import FPDF
199
  from PIL import Image
 
216
  pdf.output(pdf_output_path)
217
  return pdf_output_path
218
 
 
 
 
 
 
219
 
220
 
221
  iface = gr.Interface(
222
  fn=transcribe_audio,
223
  inputs=gr.Audio(type="filepath"),
224
+ outputs=gr.Textbox(label="Transcription"),
225
  title="SW Transcription App",
226
  description="Upload an audio file to get the text",
227
  theme="default",