NSTiwari commited on
Commit
2b60320
1 Parent(s): 29359f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -3,7 +3,10 @@ import cv2
3
  import numpy as np
4
  from transformers import AutoTokenizer, PaliGemmaForConditionalGeneration, PaliGemmaProcessor
5
  import torch
 
6
  import gradio as gr
 
 
7
 
8
  # Load PaliGemma
9
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -25,6 +28,7 @@ def draw_bounding_box(draw, coordinates, label, width, height):
25
  # Draw bounding box
26
  draw.rectangle([(x1, y1), (x2, y2)], outline="red", width=2)
27
 
 
28
  def process_video(video_path, input_text):
29
  cap = cv2.VideoCapture(video_path)
30
  fourcc = cv2.VideoWriter_fourcc(*'XVID')
 
3
  import numpy as np
4
  from transformers import AutoTokenizer, PaliGemmaForConditionalGeneration, PaliGemmaProcessor
5
  import torch
6
+ import spaces
7
  import gradio as gr
8
+ import jax
9
+ import jax.numpy as jnp
10
 
11
  # Load PaliGemma
12
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
28
  # Draw bounding box
29
  draw.rectangle([(x1, y1), (x2, y2)], outline="red", width=2)
30
 
31
+ @spaces.GPU
32
  def process_video(video_path, input_text):
33
  cap = cv2.VideoCapture(video_path)
34
  fourcc = cv2.VideoWriter_fourcc(*'XVID')