gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
30.56k stars 2.27k forks source link

Support Bash in Api Recorder #8460

Closed aliabd closed 2 weeks ago

aliabd commented 3 weeks ago

Creates API recording snippets for bash like with js and python. There was a bit of a challenge given two requests are required and the event_id is needed for the second. To keep the snippet copy-paste-able without changes I opted for using jq but i'm not sure that was the right call since the user may not have it installed already. Open to removing that.

Screen Shot 2024-06-04 at 8 56 49 PM

Also noticed a bug with the copy button on recording snippets. It would always just copy the last of the three languages to mount. Very weird. I fixed it in a bit of a roundabout way but it works as expected now.

closes: #8457

gradio-pr-bot commented 3 weeks ago

🪼 branch checks and previews

• Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
:unicorn: Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/213428d96af92300dc4ae3abf54b8c22d92d86c8/gradio-4.33.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@213428d96af92300dc4ae3abf54b8c22d92d86c8#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-builds.s3.amazonaws.com/213428d96af92300dc4ae3abf54b8c22d92d86c8/gradio-client-0.20.1.tgz
gradio-pr-bot commented 3 weeks ago

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/app patch
gradio patch

With the following changelog entry.

Support Bash in Api Recorder

Maintainers or the PR author can modify the PR title to modify this entry.

#### Something isn't right? - Maintainers can change the version label to modify the version bump. - If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can [update the changelog file directly](https://github.com/gradio-app/gradio/edit/aliabd/api-recorder-changes/.changeset/empty-moons-stick.md).
abidlabs commented 3 weeks ago

Thanks for taking care of this @aliabd! I like the suggestion of saving the event_id to a variable so that the snippet is completely copy-able. Could we make the regular code snippet like that as wells? I do think we should avoid jq but it should be pretty easy to do this with awk which is installed by default in most OS-es

aliabd commented 3 weeks ago

Made the changes if you can take another look @abidlabs