Spaces:
Sleeping
Sleeping
Factor Studios
commited on
Update http_storage.py
Browse files- http_storage.py +6 -6
http_storage.py
CHANGED
|
@@ -256,7 +256,7 @@ class HTTPGPUStorage:
|
|
| 256 |
|
| 257 |
response = self._make_request(
|
| 258 |
'POST',
|
| 259 |
-
f'/state/{component}/{state_id}',
|
| 260 |
json=request_data
|
| 261 |
)
|
| 262 |
|
|
@@ -273,7 +273,7 @@ class HTTPGPUStorage:
|
|
| 273 |
def load_state(self, component: str, state_id: str) -> Optional[Dict[str, Any]]:
|
| 274 |
"""Load component state via HTTP API"""
|
| 275 |
try:
|
| 276 |
-
response = self._make_request(
|
| 277 |
|
| 278 |
if response and response.get('status') == 'success':
|
| 279 |
return response.get('data')
|
|
@@ -292,7 +292,7 @@ class HTTPGPUStorage:
|
|
| 292 |
|
| 293 |
response = self._make_request(
|
| 294 |
'POST',
|
| 295 |
-
f'/cache/{key}',
|
| 296 |
json=request_data
|
| 297 |
)
|
| 298 |
|
|
@@ -305,7 +305,7 @@ class HTTPGPUStorage:
|
|
| 305 |
def get_cached_data(self, key: str) -> Optional[Any]:
|
| 306 |
"""Get cached data via HTTP API"""
|
| 307 |
try:
|
| 308 |
-
response = self._make_request(
|
| 309 |
|
| 310 |
if response and response.get('status') == 'success':
|
| 311 |
return response.get('data')
|
|
@@ -318,7 +318,7 @@ class HTTPGPUStorage:
|
|
| 318 |
def is_model_loaded(self, model_name: str) -> bool:
|
| 319 |
"""Check if a model is loaded via HTTP API"""
|
| 320 |
try:
|
| 321 |
-
response = self._make_request(
|
| 322 |
|
| 323 |
if response and response.get('status') == 'loaded':
|
| 324 |
return True
|
|
@@ -349,7 +349,7 @@ class HTTPGPUStorage:
|
|
| 349 |
|
| 350 |
response = self._make_request(
|
| 351 |
'POST',
|
| 352 |
-
f'/models/{model_name}/load',
|
| 353 |
json=request_data
|
| 354 |
)
|
| 355 |
|
|
|
|
| 256 |
|
| 257 |
response = self._make_request(
|
| 258 |
'POST',
|
| 259 |
+
f'/api/v1/state/{component}/{state_id}',
|
| 260 |
json=request_data
|
| 261 |
)
|
| 262 |
|
|
|
|
| 273 |
def load_state(self, component: str, state_id: str) -> Optional[Dict[str, Any]]:
|
| 274 |
"""Load component state via HTTP API"""
|
| 275 |
try:
|
| 276 |
+
response = self._make_request("GET", f"/api/v1/state/{component}/{state_id}")
|
| 277 |
|
| 278 |
if response and response.get('status') == 'success':
|
| 279 |
return response.get('data')
|
|
|
|
| 292 |
|
| 293 |
response = self._make_request(
|
| 294 |
'POST',
|
| 295 |
+
f'/api/v1/cache/{key}',
|
| 296 |
json=request_data
|
| 297 |
)
|
| 298 |
|
|
|
|
| 305 |
def get_cached_data(self, key: str) -> Optional[Any]:
|
| 306 |
"""Get cached data via HTTP API"""
|
| 307 |
try:
|
| 308 |
+
response = self._make_request("GET", f"/api/v1/cache/{key}")
|
| 309 |
|
| 310 |
if response and response.get('status') == 'success':
|
| 311 |
return response.get('data')
|
|
|
|
| 318 |
def is_model_loaded(self, model_name: str) -> bool:
|
| 319 |
"""Check if a model is loaded via HTTP API"""
|
| 320 |
try:
|
| 321 |
+
response = self._make_request("GET", f"/api/v1/models/{model_name}/status")
|
| 322 |
|
| 323 |
if response and response.get('status') == 'loaded':
|
| 324 |
return True
|
|
|
|
| 349 |
|
| 350 |
response = self._make_request(
|
| 351 |
'POST',
|
| 352 |
+
f'/api/v1/models/{model_name}/load',
|
| 353 |
json=request_data
|
| 354 |
)
|
| 355 |
|