seungheondoh commited on
Commit
ab464b2
β€’
1 Parent(s): 1fe02e5
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,7 +23,7 @@ state_dict = pretrained_object['state_dict']
23
  model.load_state_dict(state_dict)
24
  if torch.cuda.is_available():
25
  torch.cuda.set_device(device)
26
- model = model.cuda(device)
27
  model.eval()
28
 
29
  def get_audio(audio_path, duration=10, target_sr=16000):
@@ -47,7 +47,7 @@ def get_audio(audio_path, duration=10, target_sr=16000):
47
 
48
  def captioning(audio_path):
49
  audio_tensor = get_audio(audio_path = audio_path)
50
- if device is not None:
51
  audio_tensor = audio_tensor.to(device)
52
  with torch.no_grad():
53
  output = model.generate(
 
23
  model.load_state_dict(state_dict)
24
  if torch.cuda.is_available():
25
  torch.cuda.set_device(device)
26
+ model = model.cuda(device)
27
  model.eval()
28
 
29
  def get_audio(audio_path, duration=10, target_sr=16000):
 
47
 
48
  def captioning(audio_path):
49
  audio_tensor = get_audio(audio_path = audio_path)
50
+ if torch.cuda.is_available():
51
  audio_tensor = audio_tensor.to(device)
52
  with torch.no_grad():
53
  output = model.generate(