Delik commited on
Commit
93d373e
1 Parent(s): 9946e7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import spaces
2
  import gradio as gr
3
  import os
@@ -9,6 +10,9 @@ try:
9
  "pyannote/speaker-diarization-3.1",
10
  use_auth_token=os.environ["api"]
11
  )
 
 
 
12
  except Exception as e:
13
  print(f"Error initializing pipeline: {e}")
14
  pipeline = None
 
1
+ import torch
2
  import spaces
3
  import gradio as gr
4
  import os
 
10
  "pyannote/speaker-diarization-3.1",
11
  use_auth_token=os.environ["api"]
12
  )
13
+ # Move the pipeline to the GPU
14
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
15
+ pipeline.to(device)
16
  except Exception as e:
17
  print(f"Error initializing pipeline: {e}")
18
  pipeline = None