tdurzynski commited on
Commit
92a0faf
·
verified ·
1 Parent(s): 9e88205

updated style

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -2,9 +2,8 @@ from transformers import pipeline
2
  import gradio as gr
3
  import os
4
 
5
- # Load the ASR model
6
- asr = pipeline(task="automatic-speech-recognition",
7
- model="distil-whisper/distil-small.en")
8
 
9
  # Define the transcription function
10
  def transcribe_long_form(filepath):
@@ -13,13 +12,21 @@ def transcribe_long_form(filepath):
13
  output = asr(filepath)
14
  return output['text']
15
 
 
 
 
 
 
 
16
  # Set up the Gradio interface
17
- with gr.Blocks() as demo:
 
 
18
  with gr.Tab("Transcribe Audio"):
19
  with gr.Row():
20
- audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath")
21
  submit_button = gr.Button("Transcribe")
22
- transcription_output = gr.Textbox(label="Transcription", lines=3)
23
 
24
  submit_button.click(
25
  transcribe_long_form,
 
2
  import gradio as gr
3
  import os
4
 
5
+ # Load the ASR model from Hugging Face Hub
6
+ asr = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
 
7
 
8
  # Define the transcription function
9
  def transcribe_long_form(filepath):
 
12
  output = asr(filepath)
13
  return output['text']
14
 
15
+ # Custom CSS to improve the interface
16
+ css = """
17
+ body { font-family: Arial, sans-serif; }
18
+ button { background-color: #4CAF50; color: white; border: none; padding: 10px 20px; }
19
+ """
20
+
21
  # Set up the Gradio interface
22
+ with gr.Blocks(css=css) as demo:
23
+ gr.Markdown("### Audio Transcription Service")
24
+ gr.Markdown("Upload an audio file or use your microphone to record one. Then press the 'Transcribe' button to see the transcription.")
25
  with gr.Tab("Transcribe Audio"):
26
  with gr.Row():
27
+ audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath", label="Upload or Record Audio")
28
  submit_button = gr.Button("Transcribe")
29
+ transcription_output = gr.Textbox(label="Transcription", lines=10, placeholder="Your transcription will appear here...")
30
 
31
  submit_button.click(
32
  transcribe_long_form,