Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -169,7 +169,7 @@ def retrieve_context(source_code: str, n_results: int = 3) -> str:
|
|
| 169 |
# --- Inference ---
|
| 170 |
|
| 171 |
|
| 172 |
-
@spaces.GPU
|
| 173 |
def generate_spec(
|
| 174 |
source_code: str,
|
| 175 |
temperature: float = 0.7,
|
|
@@ -279,6 +279,11 @@ def create_app():
|
|
| 279 |
return app
|
| 280 |
|
| 281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
if __name__ == "__main__":
|
| 283 |
app = create_app()
|
| 284 |
app.launch()
|
|
|
|
| 169 |
# --- Inference ---
|
| 170 |
|
| 171 |
|
| 172 |
+
@spaces.GPU(duration=300)
|
| 173 |
def generate_spec(
|
| 174 |
source_code: str,
|
| 175 |
temperature: float = 0.7,
|
|
|
|
| 279 |
return app
|
| 280 |
|
| 281 |
|
| 282 |
+
# Preload model on startup (before GPU decorator kicks in)
|
| 283 |
+
print("Preloading model and adapter...")
|
| 284 |
+
download_adapter()
|
| 285 |
+
print("Adapter ready. Model will load on first GPU request.")
|
| 286 |
+
|
| 287 |
if __name__ == "__main__":
|
| 288 |
app = create_app()
|
| 289 |
app.launch()
|