Spaces:
Sleeping
Sleeping
Upload frontend/api/gs_engine.py with huggingface_hub
Browse files
frontend/api/gs_engine.py
CHANGED
|
@@ -10,9 +10,11 @@ class GSEngine:
|
|
| 10 |
self.generation_queue = {}
|
| 11 |
try:
|
| 12 |
self.client = Client("ashawkey/LGM")
|
|
|
|
| 13 |
print("Connected to HuggingFace LGM Space.")
|
| 14 |
except Exception as e:
|
| 15 |
print("Failed to connect to LGM:", e)
|
|
|
|
| 16 |
self.client = None
|
| 17 |
|
| 18 |
async def start_generation(self, layout_data: dict, prompt: str = "", image_bytes: bytes = None) -> str:
|
|
@@ -37,7 +39,7 @@ class GSEngine:
|
|
| 37 |
tmp_path = tmp.name
|
| 38 |
|
| 39 |
if not self.client:
|
| 40 |
-
raise Exception("LGM Client not initialized.")
|
| 41 |
|
| 42 |
print(f"[{job_id}] Uploading to HuggingFace LGM API...")
|
| 43 |
loop = asyncio.get_event_loop()
|
|
|
|
| 10 |
self.generation_queue = {}
|
| 11 |
try:
|
| 12 |
self.client = Client("ashawkey/LGM")
|
| 13 |
+
self.init_error = None
|
| 14 |
print("Connected to HuggingFace LGM Space.")
|
| 15 |
except Exception as e:
|
| 16 |
print("Failed to connect to LGM:", e)
|
| 17 |
+
self.init_error = str(e)
|
| 18 |
self.client = None
|
| 19 |
|
| 20 |
async def start_generation(self, layout_data: dict, prompt: str = "", image_bytes: bytes = None) -> str:
|
|
|
|
| 39 |
tmp_path = tmp.name
|
| 40 |
|
| 41 |
if not self.client:
|
| 42 |
+
raise Exception(f"LGM Client not initialized. Cause: {self.init_error}")
|
| 43 |
|
| 44 |
print(f"[{job_id}] Uploading to HuggingFace LGM API...")
|
| 45 |
loop = asyncio.get_event_loop()
|