Skip to content
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

Support additional_outputs in gr.ChatInterface #10071

Merged
merged 33 commits into from
Dec 2, 2024
Merged

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Nov 28, 2024

See: demo/chatinterface_artifacts/run.py for a simple example

Closes: #7933

Some minor fixes to the docs as well

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Nov 28, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/591dcd0e324782bf8d635d63e21b26deaacdb0e4/gradio-5.7.1-py3-none-any.whl

Install Gradio Python Client from this PR

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

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/591dcd0e324782bf8d635d63e21b26deaacdb0e4/gradio-client-1.8.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/591dcd0e324782bf8d635d63e21b26deaacdb0e4/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Nov 28, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio minor
website minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Support additional_outputs in gr.ChatInterface

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.

@abidlabs abidlabs changed the title Additional outputs in gr.ChatInterface Support additional_outputs in gr.ChatInterface Nov 29, 2024
@abidlabs abidlabs marked this pull request as ready for review November 29, 2024 21:35
warnings.warn(
"The type of the chatbot does not match the type of the chat interface. The type of the chat interface will be used."
"Recieved type of chatbot: {chatbot.type}, type of chat interface: {self.type}"
with Column():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Column() is needed b/c otherwise if you put gr.ChatInterface in a gr.Row(), the textbox appears to the right of the chatbot instead of below it.

Copy link
Collaborator

@aliabd aliabd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything LGTM! thanks @abidlabs

@abidlabs
Copy link
Member Author

abidlabs commented Dec 1, 2024

Note to self: add link to demo since gr.ParamViewer now supports links

@abidlabs
Copy link
Member Author

abidlabs commented Dec 2, 2024

Works great!

Screen.Recording.2024-12-02.at.4.12.56.PM.mov

if requirements:
encoded_reqs = base64.b64encode(requirements.encode('utf-8')).decode('utf-8')
encoded_reqs_url = urllib.parse.quote(encoded_reqs, safe='')
playground_url += "&reqs=" + encoded_reqs_url
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that it handles reqs as well!

@abidlabs
Copy link
Member Author

abidlabs commented Dec 2, 2024

Nice @aliabd! I'm going to get this in

@abidlabs abidlabs merged commit 01b919f into main Dec 2, 2024
22 of 23 checks passed
@abidlabs abidlabs deleted the additional-outputs branch December 2, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for additional_outputs in gr.ChatInterface
3 participants