Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -5,7 +5,20 @@ import json
|
|
| 5 |
import torch
|
| 6 |
import cv2
|
| 7 |
from PIL import Image
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import os
|
| 10 |
import time
|
| 11 |
import logging
|
|
|
|
| 5 |
import torch
|
| 6 |
import cv2
|
| 7 |
from PIL import Image
|
| 8 |
+
|
| 9 |
+
# Опциональный импорт spaces - нужен только для HF Spaces
|
| 10 |
+
try:
|
| 11 |
+
import spaces
|
| 12 |
+
HF_SPACES = True
|
| 13 |
+
except ImportError:
|
| 14 |
+
HF_SPACES = False
|
| 15 |
+
class spaces:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def GPU(duration=None):
|
| 18 |
+
def decorator(func):
|
| 19 |
+
return func
|
| 20 |
+
return decorator
|
| 21 |
+
|
| 22 |
import os
|
| 23 |
import time
|
| 24 |
import logging
|