Spaces:
Sleeping
Sleeping
Update app.py
Browse files53 unmodified lines54555657575859605 unmodified lines6667686970717273747576777879808182838485868788899091929370717294959697989910010110210310410510610733 unmodified lines14114214311714453 unmodified lines raise ValueError("μ΄λ―Έμ§μ μ€λμ€λ₯Ό λͺ¨λ μ
λ‘λνμΈμ.")
progress(0.05, desc="νμΌ μ€λΉ") client = Client(API_URL) # β timeout μΈμ μμ client = Client(API_URL)
progress(0.15, desc="μλ² νΈμΆ μ€β¦ (μ λΆ μμ κ°λ₯)") result = client.predict(5 unmodified lines )
progress(0.95, desc="κ²°κ³Ό μ 리") # κ²°κ³Ό μ²λ¦¬ - dict νν μ²λ¦¬ μΆκ° def extract_video_path(obj): """λΉλμ€ κ°μ²΄μμ κ²½λ‘ μΆμΆ""" if isinstance(obj, str): return obj elif isinstance(obj, dict): # Gradioμ FileData dict μ²λ¦¬ if 'path' in obj: return obj['path'] elif 'url' in obj: return obj['url'] elif 'name' in obj: return obj['name'] else: log.warning(f"Unexpected dict structure: {obj.keys()}") return None else: log.warning(f"Unexpected type: {type(obj)}") return None if isinstance(result, (list, tuple)) and len(result) >= 2: anim_path = extract_video_path(result[0]) comp_path = extract_video_path(result[1]) anim, comp = result[0], result[1] logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] μ±κ³΅") return anim, comp, "\n".join(logs) if anim_path and comp_path: logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] μ±κ³΅") return anim_path, comp_path, "\n".join(logs) else: raise RuntimeError(f"λΉλμ€ κ²½λ‘ μΆμΆ μ€ν¨: {result}") else: raise RuntimeError(f"μμμΉ λͺ»ν λ°ν νμ: {type(result)}")
except Exception as e: logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] μ€λ₯: {e}") log.error(f"Animation generation error: {e}", exc_info=True) return None, None, "\n".join(logs)
# βββββββββββββββββββββββ UI μ μ ββββββββββββββββββββββ #33 unmodified lines server_name="0.0.0.0", server_port=7860, show_api=False ) )app.py+32-5