Vector857 commited on
Commit
b2786ee
Β·
verified Β·
1 Parent(s): f3e330f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -268,14 +268,23 @@ def format_history_html(history: list) -> str:
268
 
269
  # ── CORE LOGIC ────────────────────────────────────────────────────────────────
270
 
271
- @spaces.GPU(duration=120)
272
  def generate(
273
- prompt, neg_prompt, cfg, steps, selected_index,
274
- randomize_seed, seed, aspect, lora_scale, speed_mode,
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: