Fix EndpointHandler class name and remove PIL dependencies
Browse files- handler.py +3 -8
handler.py
CHANGED
|
@@ -3,16 +3,11 @@ import sys
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
-
from PIL import Image
|
| 7 |
-
import io
|
| 8 |
-
import base64
|
| 9 |
from typing import Dict, Any, List
|
| 10 |
-
import tempfile
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
sys.path.append('/workspace/SVGDreamer')
|
| 14 |
|
| 15 |
-
class
|
| 16 |
def __init__(self, path=""):
|
| 17 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 18 |
self.model_loaded = False
|
|
@@ -336,4 +331,4 @@ class SVGDreamerHandler:
|
|
| 336 |
return svg_content
|
| 337 |
|
| 338 |
# Create handler instance
|
| 339 |
-
handler =
|
|
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
| 6 |
from typing import Dict, Any, List
|
|
|
|
| 7 |
|
| 8 |
+
# SVGDreamer handler for Hugging Face Inference API
|
|
|
|
| 9 |
|
| 10 |
+
class EndpointHandler:
|
| 11 |
def __init__(self, path=""):
|
| 12 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 13 |
self.model_loaded = False
|
|
|
|
| 331 |
return svg_content
|
| 332 |
|
| 333 |
# Create handler instance
|
| 334 |
+
handler = EndpointHandler()
|