Gijs Wijngaard commited on
Commit
252b17b
·
1 Parent(s): 1311855
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  import torch
4
  import torchaudio
5
  from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
6
-
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  model_name = "ibm-granite/granite-speech-3.3-8b"
@@ -23,7 +23,7 @@ def _load_audio_mono_16k(file_path: str) -> torch.Tensor:
23
  wav = torchaudio.functional.resample(wav, sr, 16000)
24
  return wav
25
 
26
-
27
  def process_audio(audio_path: str, instruction: str, max_tokens: int = 200) -> str:
28
  if not audio_path:
29
  return "Please upload an audio file."
 
3
  import torch
4
  import torchaudio
5
  from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
6
+ import spaces
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  model_name = "ibm-granite/granite-speech-3.3-8b"
 
23
  wav = torchaudio.functional.resample(wav, sr, 16000)
24
  return wav
25
 
26
+ @spaces.GPU
27
  def process_audio(audio_path: str, instruction: str, max_tokens: int = 200) -> str:
28
  if not audio_path:
29
  return "Please upload an audio file."