Closed sushanthpy closed 1 week ago
@MyNiuuu Just wondering if you had a chance to review it.
@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.
We have merged this branch to the main branch, thanks for your contribution!
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.