Anupam007 commited on
Commit
48e44ca
·
verified ·
1 Parent(s): 8080b98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import os
2
- import time
3
  import gradio as gr
4
  import torch
5
  import numpy as np
6
  import tempfile
7
  import librosa
8
- import whisper
9
  import re
10
  from gtts import gTTS
11
  from transformers import pipeline, T5ForConditionalGeneration, T5Tokenizer
 
 
12
 
13
  # Ensure correct device setting
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -16,7 +16,7 @@ print(f"Using device: {device}")
16
 
17
  # Load models with error handling
18
  try:
19
- whisper_model = whisper.load_model("small", device=device)
20
  except Exception as e:
21
  print(f"Failed to load Whisper model: {e}")
22
  whisper_model = None
 
1
  import os
 
2
  import gradio as gr
3
  import torch
4
  import numpy as np
5
  import tempfile
6
  import librosa
 
7
  import re
8
  from gtts import gTTS
9
  from transformers import pipeline, T5ForConditionalGeneration, T5Tokenizer
10
+ import whisper
11
+ import sentencepiece # Ensure SentencePiece is imported
12
 
13
  # Ensure correct device setting
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
16
 
17
  # Load models with error handling
18
  try:
19
+ whisper_model = whisper.load_model("small")
20
  except Exception as e:
21
  print(f"Failed to load Whisper model: {e}")
22
  whisper_model = None