-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Simpler Chatbot Component / API #3510
Comments
I agree. :( @abidlabs. Your posts are useful but this is really hard unless you spend alot of time figuring it out. For instance how do I get a "regenerate" tab to work (to get a new chat generation for the same input in case it was poor)? Secondly how do I get this chatbot to produce outputs as it is typing like chatgpt or even this demo does: https://chat.lmsys.org/? See my hacked together code:
Honestly the code above doenst make a ton of sense to me but it works. Its really hard and I find myself unable to understand what is going on in Gradio code alot of times as it takes away from ml development. I'd love if I could figure out how to get it do the two things I asked about though. :( If any thing it would be nice to just drop models into a predefined template chatbot or some thing with several toggleable features. |
Thanks @pGit1 for your questions and feedback. We'll think about this as we build towards 4.0. In the meantime, you can get streaming responses by using For regenerate, you would simply rerun the If you are not already familiar with Blocks, I would go through the "Building with Blocks" section of the Gradio Guides: https://gradio.app/blocks-and-event-listeners/ |
@abidlabs the streaming output makes sense I think, and I will update my code accordingly. Thanks for the event listeners section. I briefly looked over it but dont seem to find the answer for regenerate button related to the answer you provided. But Concerning the "regenerate" button would my code look something like:
? Thanks for your help! :) |
I cant get this regenerate button to work. 😢 But the "streaming" works now. I have LITERALLY spent two hours on this and cant get desired dinctionality:
The only way I can get this to work is Without streaming the outputs. |
Hi @pGit1 please take a look at this Space to get an idea of how to add a Regenerate button: https://huggingface.co/spaces/project-baize/Baize-7B |
@abidlabs This: https://huggingface.co/spaces/project-baize/Baize-7B/blob/main/app.py is literally the problem. This is unnecessarily complicated and EVERYONE does this stuff a significantly different way. Its quite annoying but I will try to parse all this code. Thx for the reference. The fact that code I posted below does not have a clear retry button functionality is a bit annoying. For now I am getting regenerate functionality without the ability to yield tokens one by one. |
I would make the textbox have no container and no label, and then make the textbox and submit in the same row - submit should have scale=0. Or maybe all the buttons grouped in a Column and in the same row as the textbox - grouping in a column will make them all move to the next row if any of them wrap |
@abidlabs should this be done after the |
Thanks @aliabid94 @dawoodkhan82 @pngwn Will try to make the UI more like what @pngwn showed
We can use emojis before the text, which is actually what a lot of popular gradio chatbots do right now.
I don't think we need to wait because one value of having a high-level abstraction like this is that we could refactor underlying implementation details and everyone's demo would still work. But let's touch upon this point in retro in case I'm misunderstanding |
@abidlabs I was just thinking if we have to add more params for |
Thanks for the proposal @abidlabs ! I agree this will make chat demos way easier to grok for new users. I like that it's implemented as a Some comments I have:
|
Thanks @freddyaboulton and all! Will open up a PR towards the end of this week for us to try out |
The one problem I can see with this approach is that it will fall apart when a user has to deviate from the supported implementation. For example, if a user wants to build a multi-modal chatbot, they will have to start from scratch to add an UploadButton. The quick fix would be to expand the init method of ChatInterface to allow an optional UploadButton but I wonder if there's a way to make it really easy to add incremental changes. This is a general point about Blocks. I don't have a solution so this comment is mainly just food-for-thought. |
Yes, that's the tradeoff, but I think it's the same tradeoff with Interface, and Interface has been quite successful imo in getting people started with Gradio |
For this use case specifically, I think the best thing to do would be to have a rich textbox component (#4668) and allow that to be used in place of the plain textbox via a parameter. I'll add a note in the upcoming PR |
Can we just implement a simple user facing interface to get this
functionality? https://chat.lmsys.org/?arena
Something like this would be awesome with hopefully an easy way to add more
hyperparameters as needed.
…On Wed, Jul 5, 2023 at 5:39 PM Abubakar Abid ***@***.***> wrote:
For example, if a user wants to build a multi-modal chatbot, they will
have to start from scratch to add an UploadButton. The quick fix would be
to expand the init method of ChatInterface to allow an optional
UploadButton but I wonder if there's a way to make it really easy to add
incremental changes.
For this use case specifically, I think the best thing to do would be to
have a rich textbox component (#4668
<#4668>) and allow that to be
used in place of the plain textbox
—
Reply to this email directly, view it on GitHub
<#3510 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADKT4SULAYVICOQF2M262F3XOXNIPANCNFSM6AAAAAAV75P5VQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Building a Chatbot is a very common use case that is currently fairly complex to do with Gradio. Here's all the code that's needed for the simple Chatbot:
We should consider having a custom component / higher-level abstraction for the Chatbot.
The text was updated successfully, but these errors were encountered: