Spaces:
Sleeping
Sleeping
Commit
·
7495ae7
1
Parent(s):
b2b2425
Define GPU function immediately after spaces import for detection
Browse files
app.py
CHANGED
|
@@ -9,6 +9,16 @@ This Gradio app provides:
|
|
| 9 |
- SSE streaming support
|
| 10 |
"""
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
import logging
|
| 13 |
import time
|
| 14 |
from typing import Optional
|
|
@@ -19,8 +29,6 @@ from fastapi import Header, HTTPException
|
|
| 19 |
from fastapi.responses import StreamingResponse, JSONResponse
|
| 20 |
from huggingface_hub import HfApi
|
| 21 |
|
| 22 |
-
# Import spaces - required for ZeroGPU
|
| 23 |
-
import spaces
|
| 24 |
ZEROGPU_AVAILABLE = True
|
| 25 |
|
| 26 |
from config import get_config, get_quota_tracker
|
|
|
|
| 9 |
- SSE streaming support
|
| 10 |
"""
|
| 11 |
|
| 12 |
+
# Import spaces FIRST - required for ZeroGPU GPU detection
|
| 13 |
+
import spaces
|
| 14 |
+
|
| 15 |
+
# Define a GPU function immediately after importing spaces
|
| 16 |
+
# This ensures ZeroGPU detects it at startup
|
| 17 |
+
@spaces.GPU(duration=60)
|
| 18 |
+
def _zerogpu_test():
|
| 19 |
+
"""Test function for ZeroGPU detection."""
|
| 20 |
+
return True
|
| 21 |
+
|
| 22 |
import logging
|
| 23 |
import time
|
| 24 |
from typing import Optional
|
|
|
|
| 29 |
from fastapi.responses import StreamingResponse, JSONResponse
|
| 30 |
from huggingface_hub import HfApi
|
| 31 |
|
|
|
|
|
|
|
| 32 |
ZEROGPU_AVAILABLE = True
|
| 33 |
|
| 34 |
from config import get_config, get_quota_tracker
|