ManishThota commited on
Commit
a6e0554
1 Parent(s): d54881f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -2,6 +2,7 @@ from transformers import BitsAndBytesConfig, LlavaNextVideoForConditionalGenerat
2
  import torch
3
  import numpy as np
4
  import av
 
5
 
6
 
7
  quantization_config = BitsAndBytesConfig(
@@ -18,7 +19,7 @@ model = LlavaNextVideoForConditionalGeneration.from_pretrained(
18
  device_map='auto'
19
  )
20
 
21
-
22
  def read_video_pyav(container, indices):
23
  '''
24
  Decode the video with PyAV decoder.
@@ -41,6 +42,7 @@ def read_video_pyav(container, indices):
41
  frames.append(frame)
42
  return np.stack([x.to_ndarray(format="rgb24") for x in frames])
43
 
 
44
  def process_video(video_file, question):
45
  # Open video and sample frames
46
  with av.open(video_file) as container:
 
2
  import torch
3
  import numpy as np
4
  import av
5
+ import spaces
6
 
7
 
8
  quantization_config = BitsAndBytesConfig(
 
19
  device_map='auto'
20
  )
21
 
22
+ @spaces.GPU
23
  def read_video_pyav(container, indices):
24
  '''
25
  Decode the video with PyAV decoder.
 
42
  frames.append(frame)
43
  return np.stack([x.to_ndarray(format="rgb24") for x in frames])
44
 
45
+ @spaces.GPU
46
  def process_video(video_file, question):
47
  # Open video and sample frames
48
  with av.open(video_file) as container: