dwb2023 commited on
Commit
2d4d7e5
·
verified ·
1 Parent(s): 35c87e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import yt_dlp as youtube_dl
3
- from transformers import pipeline, BitsAndBytesConfig, WhisperForConditionalGeneration, WhisperTokenizer
4
  from transformers.pipelines.audio_utils import ffmpeg_read
5
  import torch
6
  from huggingface_hub import CommitScheduler
@@ -25,7 +25,7 @@ device = 0 if torch.cuda.is_available() else "cpu"
25
  bnb_config = BitsAndBytesConfig(load_in_4bit=True)
26
 
27
  # Load the model
28
- model = model_class.from_pretrained(model_name, config=bnb_config)
29
 
30
  # bnb_config = bnb.QuantizationConfig(bits=4)
31
  pipe = pipeline(task="automatic-speech-recognition", model=model, chunk_length_s=30, device=device)
 
1
  import gradio as gr
2
  import yt_dlp as youtube_dl
3
+ from transformers import pipeline, BitsAndBytesConfig, WhisperForConditionalGeneration
4
  from transformers.pipelines.audio_utils import ffmpeg_read
5
  import torch
6
  from huggingface_hub import CommitScheduler
 
25
  bnb_config = BitsAndBytesConfig(load_in_4bit=True)
26
 
27
  # Load the model
28
+ model = WhisperForConditionalGeneration.from_pretrained(model_name, config=bnb_config)
29
 
30
  # bnb_config = bnb.QuantizationConfig(bits=4)
31
  pipe = pipeline(task="automatic-speech-recognition", model=model, chunk_length_s=30, device=device)