ccibeekeoc42 commited on
Commit
71ae2d6
·
verified ·
1 Parent(s): 9734753

Update app.py

Browse files

fixing "device" definition

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import torch
3
  from transformers import pipeline
4
 
5
  # Loading the TTS and Vocoder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
6
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
7
  from datasets import load_dataset
8
 
@@ -66,7 +67,6 @@ def generate_llm_response(text, model_id="ccibeekeoc42/Llama3.1-8b-base-SFT-2024
66
 
67
 
68
  # Loading the ST Model (Whisper) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
- device = "cuda:0" if torch.cuda.is_available() else "cpu"
70
  pipe = pipeline("automatic-speech-recognition", model="okezieowen/whisper-small-multilingual-naija-11-03-2024", device=device)
71
 
72
  # Take audio and return translated text
 
3
  from transformers import pipeline
4
 
5
  # Loading the TTS and Vocoder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
7
  from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
8
  from datasets import load_dataset
9
 
 
67
 
68
 
69
  # Loading the ST Model (Whisper) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
70
  pipe = pipeline("automatic-speech-recognition", model="okezieowen/whisper-small-multilingual-naija-11-03-2024", device=device)
71
 
72
  # Take audio and return translated text