MyNiuuu / MOFA-Video

Official Pytorch implementation for MOFA-Video: Controllable Image Animation via Generative Motion Field Adaptions in Frozen Image-to-Video Diffusion Model.
https://myniuuu.github.io/MOFA_Video
Other
358 stars 22 forks source link

Fix Exception: None and Add Local Port Configuration (Update run_gradio.py) #11

Closed sushanthpy closed 1 week ago

sushanthpy commented 1 week ago

This pull request addresses the "Exception: None" error that occurred in the add_tracking_points and delete_last_drag functions. It also adds the configuration to run the demo on a local port (9080) and localhost (127.0.0.1).

Fixes:

add_tracking_points function:

Added a condition if len(tracking_points.constructor_args['value']) == 0: to check if tracking_points.constructor_args['value'] is empty. If it is empty, a new empty list is appended to it before appending evt.index to the last element. This fix prevents the "list index out of range" error when clicking on the image to add tracking points.

delete_last_drag function:

Added a condition if len(tracking_points.constructor_args['value']) > 0: to check if the list has at least one element before attempting to remove the last element using pop(). If the list is empty, the pop() operation will be skipped, avoiding the IndexError. This fix prevents the error when clicking the "Delete Last Trajectory" button when there are no trajectories.

Enhancements:

Local Port Configuration:

Modified the launch function to use a specific local port (9080) and run the demo on localhost (127.0.0.1). This enhancement allows the demo to be run locally without conflicting with the default port 80, which is often unavailable. The demo can now be accessed at http://127.0.0.1:9080 in the web browser.

To test these changes:

Run the script with the updated code. Access the Gradio demo at http://127.0.0.1:9080 in your web browser. Upload an image using the "Upload Image" button. Click "Add Trajectory" and select points on the "Add Trajectory Here" image to create a trajectory. Verify that the trajectory is added successfully without any errors. Click "Delete Last Trajectory" to remove the last added trajectory. Verify that the last trajectory is removed successfully without any errors, even when there are no trajectories.

Please review the changes and provide any feedback or suggestions for further improvements.

sushanthpy commented 1 week ago

@MyNiuuu Just wondering if you had a chance to review it.

MyNiuuu commented 1 week ago

@MyNiuuu Just wondering if you had a chance to review it.

Hi! Thanks for your contribution. We are currently preparing the codes for hybrid control, we will go back to check the pull request as soon as we finished the preparation.

MyNiuuu commented 1 week ago

We have merged this branch to the main branch, thanks for your contribution!