-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update object detection guide #9456
base: 5.0-dev
Are you sure you want to change the base?
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/b4e83529f7a715ede0c3af2467ef31d1eafdf750/gradio-4.44.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@b4e83529f7a715ede0c3af2467ef31d1eafdf750#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/b4e83529f7a715ede0c3af2467ef31d1eafdf750/gradio-client-1.6.0-beta.3.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/b4e83529f7a715ede0c3af2467ef31d1eafdf750/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
@@ -15,6 +15,11 @@ def copy_js_code(root: str | pathlib.Path): | |||
"playwright-report", | |||
"workbench", | |||
"tooltils", | |||
"component-test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to move any of these directories to _frontend_code
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to some custom component fixing clean-up I'll do in a different PR
@@ -1243,7 +1243,10 @@ async def component_server( | |||
status_code=status.HTTP_404_NOT_FOUND, | |||
detail="Function not found.", | |||
) | |||
return fn(body.data) | |||
if inspect.iscoroutinefunction(fn): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that you can use async functions in @server
decorator. Needed for webrtc component.
gr.HTML( | ||
""" | ||
<h3 style='text-align: center'> | ||
<a href='https://arxiv.org/abs/2405.14458' target='_blank'>arXiv</a> | <a href='https://github.com/THU-MIG/yolov10' target='_blank'>github</a> | ||
</h3> | ||
""" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest removing to keep the demo simpler, but up to you
gr.HTML( | |
""" | |
<h3 style='text-align: center'> | |
<a href='https://arxiv.org/abs/2405.14458' target='_blank'>arXiv</a> | <a href='https://github.com/THU-MIG/yolov10' target='_blank'>github</a> | |
</h3> | |
""" | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
## Setting up the Model | ||
![WebRTC Object Detection Demo](https://github.com/user-attachments/assets/4584cec6-8c1a-401b-9b61-a4fe0718b558) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Video seems to be broken: https://gradio-4u4cvrf1d-hugging-face.vercel.app/main/guides/object-detection-from-webcam
|
||
* The user's webcam will be both an input and an output. That way, the user will only see their stream with the detected objects. | ||
* We'll use the `time_limit` and `stream_every` parameters of the `stream` event. The `time_limit` parameter will mean that we'll process each user's stream for that amount of time. In a multi-user setting, such as on Spaces, this means that after this period of time, the next user in the queue will be able to use the demo. The `stream_every` function will control how frequently the webcam stream is sent to the server. | ||
1. Use the `WebRTC` custom component to ensure input and output are sent to/from the server with WebRTC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the webrtc custom component here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant @freddyaboulton!
Description
Update the webcam detection guide to use WebRTC and yolo-v10
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh