Spaces:
Runtime error
Runtime error
Update app.py
Browse files164 unmodified lines165166167168169170171172173174175176177178179164 unmodified linesstate_manager.set_item('target_path', None)state_manager.set_item('processors', ['face_swapper', 'face_enhancer'])# Optional: Reset other sensitive items if needed# Initialize UIui_core.init()# Launch logicwith gr.Blocks(theme=get_theme(), css=get_css(), title=metadata.get('name') + ' ' + metadata.get('version')) as demo:# Trigger reset on loaddemo.load(reset_state, outputs=None)default_layout.render()with gr.Row():gr.Button("YouTube 📺", link="https://www.youtube.com/@AI_Guruji_97")gr.Button("Instagram 📸", link="https://www.instagram.com/aiguruji97/")164 unmodified lines165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209164 unmodified linesstate_manager.set_item('target_path', None)state_manager.set_item('processors', ['face_swapper', 'face_enhancer'])# Optional: Reset other sensitive items if needed# Return values to clear UI componentsreturn None, None, None, None, None, None# Initialize UIui_core.init()# Launch logicwith gr.Blocks(theme=get_theme(), css=get_css(), title=metadata.get('name') + ' ' + metadata.get('version')) as demo:default_layout.render()# Import components AFTER render, as they are populated during renderfrom facefusion.uis.components import source, target, preview# Trigger reset on load, targeting specific UI components to clear them visuallydemo.load(reset_state, outputs=[source.SOURCE_FILE, source.SOURCE_IMAGE, source.SOURCE_AUDIO,target.TARGET_FILE, target.TARGET_IMAGE, target.TARGET_VIDEO])# Note: Preview component is tricky to clear directly if not exposed, but resetting state helps.# ideally we should also target PREVIEW_IMAGE if accessible.try:if preview.PREVIEW_IMAGE:demo.load(reset_state, outputs=[source.SOURCE_FILE, source.SOURCE_IMAGE, source.SOURCE_AUDIO,target.TARGET_FILE, target.TARGET_IMAGE, target.TARGET_VIDEO,preview.PREVIEW_IMAGE])else:# Fallback if preview isn't readydemo.load(reset_state, outputs=[source.SOURCE_FILE, source.SOURCE_IMAGE, source.SOURCE_AUDIO,target.TARGET_FILE, target.TARGET_IMAGE, target.TARGET_VIDEO])except Exception as e:print(f"Warning: Could not bind reset to preview: {e}")demo.load(reset_state, outputs=[source.SOURCE_FILE, source.SOURCE_IMAGE, source.SOURCE_AUDIO,target.TARGET_FILE, target.TARGET_IMAGE, target.TARGET_VIDEO])with gr.Row():gr.Button("YouTube 📺", link="https://www.youtube.com/@AI_Guruji_97")gr.Button("Instagram 📸", link="https://www.instagram.com/aiguruji97/")
app.py+32-2