Spaces:
Sleeping
Sleeping
Update app.py
Browse files53 unmodified lines545556575859605 unmodified lines66676869707172737475767778798033 unmodified lines11411511611753 unmodified linesraise ValueError("μ΄λ―Έμ§μ μ€λμ€λ₯Ό λͺ¨λ μ λ‘λνμΈμ.")progress(0.05, desc="νμΌ μ€λΉ")client = Client(API_URL) # β timeout μΈμ μμ progress(0.15, desc="μλ² νΈμΆ μ€β¦ (μ λΆ μμ κ°λ₯)")result = client.predict(5 unmodified lines)progress(0.95, desc="κ²°κ³Ό μ 리")if isinstance(result, (list, tuple)) and len(result) >= 2:anim, comp = result[0], result[1]logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] μ±κ³΅")return anim, comp, "\n".join(logs)else:raise RuntimeError(f"μμμΉ λͺ»ν λ°ν νμ: {type(result)}")except Exception as e:logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] μ€λ₯: {e}")return None, None, "\n".join(logs)# βββββββββββββββββββββββ UI μ μ ββββββββββββββββββββββ #33 unmodified linesserver_name="0.0.0.0",server_port=7860,show_api=False)53 unmodified lines545556575859605 unmodified lines6667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610733 unmodified lines14114214314453 unmodified linesraise ValueError("μ΄λ―Έμ§μ μ€λμ€λ₯Ό λͺ¨λ μ λ‘λνμΈμ.")progress(0.05, desc="νμΌ μ€λΉ")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 objelif 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 Noneelse:log.warning(f"Unexpected type: {type(obj)}")return Noneif isinstance(result, (list, tuple)) and len(result) >= 2:anim_path = extract_video_path(result[0])comp_path = extract_video_path(result[1])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 linesserver_name="0.0.0.0",server_port=7860,show_api=False)
app.py+32-5