Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -268,14 +268,23 @@ def format_history_html(history: list) -> str:
|
|
| 268 |
|
| 269 |
# ββ CORE LOGIC ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 270 |
|
| 271 |
-
@spaces.GPU(duration=
|
| 272 |
def generate(
|
| 273 |
-
prompt, neg_prompt,
|
| 274 |
-
randomize_seed, seed,
|
| 275 |
history_state,
|
| 276 |
oauth_token: gr.OAuthToken | None = None,
|
| 277 |
progress=gr.Progress(track_tqdm=True),
|
| 278 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
if oauth_token is None:
|
| 280 |
raise gr.Error("Please sign in with your HuggingFace account to generate images.")
|
| 281 |
if selected_index is None:
|
|
|
|
| 268 |
|
| 269 |
# ββ CORE LOGIC ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 270 |
|
| 271 |
+
@spaces.GPU(duration=100)
|
| 272 |
def generate(
|
| 273 |
+
prompt, neg_prompt, cfg_sale, steps, selected_index,
|
| 274 |
+
randomize_seed, seed, aspect_ratio, lora_scale, speed_mode,
|
| 275 |
history_state,
|
| 276 |
oauth_token: gr.OAuthToken | None = None,
|
| 277 |
progress=gr.Progress(track_tqdm=True),
|
| 278 |
):
|
| 279 |
+
# --- INTHA VARIGALAI MATTUM PUTHUSA SERTHIDUNGA ---
|
| 280 |
+
try:
|
| 281 |
+
# Palaiya lora weight-ai remove panna
|
| 282 |
+
pipe.unload_lora_weights()
|
| 283 |
+
# GPU memory-ai free panna
|
| 284 |
+
torch.cuda.empty_cache()
|
| 285 |
+
except Exception as e:
|
| 286 |
+
print(f"Unload error (ithu paravaillai): {e}")
|
| 287 |
+
# ---------------------------------------------
|
| 288 |
if oauth_token is None:
|
| 289 |
raise gr.Error("Please sign in with your HuggingFace account to generate images.")
|
| 290 |
if selected_index is None:
|