-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
gr.load_chat: Allow loading any openai-compatible server immediately as a ChatInterface #10222
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/0a1285dd8d60705f86ffe137f3d0a930f3e6b986/gradio-5.9.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@0a1285dd8d60705f86ffe137f3d0a930f3e6b986#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/0a1285dd8d60705f86ffe137f3d0a930f3e6b986/gradio-client-1.8.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/0a1285dd8d60705f86ffe137f3d0a930f3e6b986/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.
|
Very cool @aliabid94! I find this part kind of confusing though:
So What about if we did the following instead?
|
Well we can't use gr.load_chat mirrors gr.load. Using gr.load as a function for a customized Interface is also the current way to customize a gr.Interface, e.g. demo = gr.Interface(fn=gr.load("model/meta-ai/llama3.2"), title="My App", examples=["a", "b"]) mirrors demo = gr.ChatInterface(fn=gr.load_chat("http://chat.com/v1"), title="My App", examples=["a", "b"]) So I think the existing API makes the most sense. |
I see thanks for explaining 👍 |
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.
lgtm works great @aliabid94! Can we add some documentation around this at the top of https://www.gradio.app/guides/creating-a-chatbot-fast?
Co-authored-by: Abubakar Abid <[email protected]>
```python | ||
import gradio as gr | ||
|
||
gr.load_chat("http://localhost:11434/v1/", "llama3.2").launch() |
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.
gr.load_chat("http://localhost:11434/v1/", "llama3.2").launch() | |
gr.load_chat("http://localhost:11434/v1/", model="llama3.2", token="ollama").launch() |
Co-authored-by: Abubakar Abid <[email protected]>
…as a ChatInterface (#10222) * changes * add changeset * add changeset * Update gradio/external.py Co-authored-by: Abubakar Abid <[email protected]> * changes * changes * Update guides/05_chatbots/01_creating-a-chatbot-fast.md Co-authored-by: Abubakar Abid <[email protected]> * changes --------- Co-authored-by: Ali Abid <[email protected]> Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Abubakar Abid <[email protected]>
* update code * modify imports * fix * update notebook * gr.load_chat: Allow loading any openai-compatible server immediately as a ChatInterface (#10222) * changes * add changeset * add changeset * Update gradio/external.py Co-authored-by: Abubakar Abid <[email protected]> * changes * changes * Update guides/05_chatbots/01_creating-a-chatbot-fast.md Co-authored-by: Abubakar Abid <[email protected]> * changes --------- Co-authored-by: Ali Abid <[email protected]> Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Abubakar Abid <[email protected]> * Allow editing chatbot messages (#10203) * changes * add changeset * changes * changes * changes * changes * changes * changes * changes * Update gradio/events.py Co-authored-by: Abubakar Abid <[email protected]> * Update gradio/components/chatbot.py Co-authored-by: Abubakar Abid <[email protected]> * changes --------- Co-authored-by: Ali Abid <[email protected]> Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Abubakar Abid <[email protected]> * Update Guides related to deploying Gradio chatbots to Discord, Slack, and website widgets (#10221) * changes * changes * update * chat history * add changeset * changes * add changeset * changes * guide * changes * changes * changes * guide * add images * slack guide * changes * format * add changeset * finish up slack * changes * improve js guide * update * changes * script * changes * changes * add changeset * Update guides/05_chatbots/01_creating-a-chatbot-fast.md Co-authored-by: Ali Abdalla <[email protected]> * Update guides/05_chatbots/01_creating-a-chatbot-fast.md Co-authored-by: Ali Abdalla <[email protected]> * Update guides/05_chatbots/06_creating-a-discord-bot-from-a-gradio-app.md Co-authored-by: Ali Abdalla <[email protected]> * Update guides/05_chatbots/08_creating-a-website-widget-from-a-gradio-chatbot.md Co-authored-by: Ali Abdalla <[email protected]> * Update guides/05_chatbots/08_creating-a-website-widget-from-a-gradio-chatbot.md Co-authored-by: Ali Abdalla <[email protected]> * gradio * cta --------- Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Ali Abdalla <[email protected]> * Allow editable ChatInterface (#10229) * changes * add changeset * changes * changes * changes --------- Co-authored-by: Ali Abid <[email protected]> Co-authored-by: gradio-pr-bot <[email protected]> * Fix typing for components in `gr.Interface` and docstring in `image.py` (#10235) * changes * add changeset * changes * changes * change * add changeset * image.py * revert msg --------- Co-authored-by: gradio-pr-bot <[email protected]> * Lite: Capture stdout and stderr from the main thread (#9984) * Add stdout and stderr events * add changeset * Refactoring * Format App.tsx * add changeset * Add python-error event to capture Python errors occurring in the running event loop after the initial app launch * Fix <ErrorDisplay />'s close button * Fix <ErrorDisplay /> * Propagate python-error and initialization-error events to the controller * Add init-code|file-run-error events --------- Co-authored-by: gradio-pr-bot <[email protected]> * use chat interface --------- Co-authored-by: Abubakar Abid <[email protected]> Co-authored-by: aliabid94 <[email protected]> Co-authored-by: Ali Abid <[email protected]> Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Ali Abdalla <[email protected]> Co-authored-by: Yuichiro Tachibana (Tsuchiya) <[email protected]>
gr.load_chat allows loading any openai chatbot immediately as a ChatInterface easily.
Can be customized as such:
I think this will be an especially popular pairing with Ollama.
In a follow up PR, will add support for media input and responses.