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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Latex Delimiters Parameter #4516
Conversation
@abidlabs lmk if you think adding both params is unnecessary. Maybe we could use passing |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4516-all-demos |
Nice! Yeah, I think both is unnecessary. You could just pass in an empty list to Also, we should mark this as a breaking change in the changelog as now by default we are only rendering LaTeX if enclosed with double $ signs. |
Some suggestions on the docs above. But tested and it works well @dawoodkhan82! |
Should it also accept |
Sure, sg |
@dawoodkhan82 this looks good. However, it's strongly recommended not to use lists (or other mutables) as argument defaults. So I'm going to change this to set the default value of
So now if you want to disable LaTeX altogether, you need to pass in an empty list |
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.
Few nits, but lgtm!
export let latex_delimiters: Array<{ | ||
left: string; | ||
right: string; | ||
display: boolean; | ||
}> = [{ left: "$$", right: "$$", display: true }]; |
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.
Since this is always set in the backend I don't think we need this default.
js/chatbot/src/ChatBot.svelte
Outdated
export let latex_delimiters: Array<{ | ||
left: string; | ||
right: string; | ||
display: boolean; | ||
}> = [{ left: "$$", right: "$$", display: true }]; |
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.
Ditto for here.
Tested the latest version with: import gradio as gr
latex = """
I want to eat $3.4 worth of bananas and $2 worth of apples. The equation for the sum is $$3.4+2=5.4$$ thanks!
"""
message = [(
"write a python program",
latex
), (
"write a python program",
latex
)]
with gr.Blocks() as demo:
gr.Chatbot(
message
)
demo.launch() And looks good to me @pngwn! |
Awesome, thanks @abidlabs! |
Description
Adds
enable_latex
andlatex_delimiters
parameters.Please include:
Closes: #4428
Checklist:
A note about the CHANGELOG
Hello 馃憢 and thank you for contributing to Gradio!
All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.
Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by
[@myusername](link-to-your-github-profile)
in[PR 11111](https://github.com/gradio-app/gradio/pull/11111)
".If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.