Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import cv2
|
|
| 6 |
import numpy as np
|
| 7 |
import torch
|
| 8 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 9 |
|
| 10 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 11 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
|
@@ -65,10 +66,14 @@ def transform_image_bbox(prompts):
|
|
| 65 |
|
| 66 |
return img, bbox, (ori_H, ori_W), (new_H, new_W)
|
| 67 |
|
|
|
|
|
|
|
|
|
|
| 68 |
if __name__ == '__main__':
|
| 69 |
|
| 70 |
model, model_type = load_model()
|
| 71 |
|
|
|
|
| 72 |
def inference_image(prompts, input_model_type):
|
| 73 |
|
| 74 |
global model_type
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
import torch
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
+
import spaces
|
| 10 |
|
| 11 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 12 |
print(f"Is CUDA available: {torch.cuda.is_available()}")
|
|
|
|
| 66 |
|
| 67 |
return img, bbox, (ori_H, ori_W), (new_H, new_W)
|
| 68 |
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
if __name__ == '__main__':
|
| 73 |
|
| 74 |
model, model_type = load_model()
|
| 75 |
|
| 76 |
+
@spaces.GPU
|
| 77 |
def inference_image(prompts, input_model_type):
|
| 78 |
|
| 79 |
global model_type
|