-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Handle special arguments when extracting parameter names for view API page #8400
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/e686632a341e5789eb5cf482e2199c7a29dd8f2b/gradio-4.32.2-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@e686632a341e5789eb5cf482e2199c7a29dd8f2b#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-builds.s3.amazonaws.com/e686632a341e5789eb5cf482e2199c7a29dd8f2b/gradio-client-0.20.1.tgz |
🦄 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.
|
Can we use something like functools.wraps in the chat_interface case to preserve the original signature? Also, I was wondering why we need to construct the special args within the chat_interface function. Shouldn't that be handled by the regular request life-cycle in Blocks. |
I think so yes I'll take a look
Sorry what are you referring to by this? |
If we can use something like |
Thanks @freddyaboulton for the suggestion. Refactored to use |
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.
Nice. The api fn implementation for chatinterface is a lot cleaner now.
Indeed. Thanks @freddyaboulton for the reviews and suggestions. |
Closes: #8399
Test with:
For the case of
gr.ChatInterface
, we can't get the original parameter names because we construct a wrapper function over the user's defined function, so in such cases, the parameter names are generated automatically: