lilyhof commited on
Commit
603d981
1 Parent(s): 95b8ced

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -57,17 +57,17 @@ class SpeechClassifier(nn.Module, PyTorchModelHubMixin):
57
 
58
  # Prepare data function
59
  def prepare_data(audio_data, sampling_rate, model_checkpoint="openai/whisper-base"):
60
-
61
  # Resample audio data to 16000 Hz
62
  audio_data_resampled = librosa.resample(audio_data, orig_sr=sampling_rate, target_sr=16000)
63
 
64
  # Initialize the feature extractor
65
  feature_extractor = WhisperFeatureExtractor.from_pretrained(model_checkpoint)
66
-
67
- # Use Dataset class
68
  dataset = SpeechInferenceDataset([{"audio": {"array": audio_data_resampled, "sampling_rate": 16000}}],
69
  text_processor=feature_extractor)
70
-
71
  return dataset
72
 
73
 
@@ -119,5 +119,5 @@ with gr.Blocks() as demo:
119
  outputs=gr.Textbox(label="Prediction")
120
  )
121
 
122
- # Launch the demo with debugging enabled
123
- demo.launch(debug=True)
 
57
 
58
  # Prepare data function
59
  def prepare_data(audio_data, sampling_rate, model_checkpoint="openai/whisper-base"):
60
+
61
  # Resample audio data to 16000 Hz
62
  audio_data_resampled = librosa.resample(audio_data, orig_sr=sampling_rate, target_sr=16000)
63
 
64
  # Initialize the feature extractor
65
  feature_extractor = WhisperFeatureExtractor.from_pretrained(model_checkpoint)
66
+
67
+ # Use Dataset class
68
  dataset = SpeechInferenceDataset([{"audio": {"array": audio_data_resampled, "sampling_rate": 16000}}],
69
  text_processor=feature_extractor)
70
+
71
  return dataset
72
 
73
 
 
119
  outputs=gr.Textbox(label="Prediction")
120
  )
121
 
122
+ # Launch the demo
123
+ demo.launch()