-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Can't add newline when using Highlighted Context #1839
Comments
Thanks for letting us know about this. Will take a look! |
For now the best way to handle this would be to affect the white-space css property of the HighlightedText component. In the example below, I've given the HighlightedText component the id 'htext', and then passed CSS to target the whitespace of the spans within the Component:
|
Let me know if this works for you, or if you have any questions! |
Thanks for your reply! |
I generate the Interface like this:
|
Ahh hmm seems like a bug where custom CSS isn't passed up in a TabbedInterface. @abidlabs can you take a look? |
This is a dupe of #1683. Going to keep both open so as to not lose all the discussion and add to 3.2 milestone. |
Hi @dyxohjl666, this is now fixed. See #1951 for more information, but the summary is that you will have to pass in a import gradio as gr
def test(text1):
return [(text1, "good"), ("\n", None), (text1, "good")]
demo = gr.Interface(
test,
"text",
gr.HighlightedText(elem_id="htext"),
)
def test(text1):
return [(text1, "good"), ("\n", None), (text1, "good")]
demo2 = gr.Interface(
test,
"text",
gr.HighlightedText(elem_id="htext2"),
)
gr.TabbedInterface([demo, demo2], css="#htext span {white-space: pre} #htext2 span {white-space: pre}").launch() |
It works well now ! Thanks a lot! |
This comment was marked as resolved.
This comment was marked as resolved.
solution: |
The newlines don’t seem to work when I try to split the multiple results. I realized it maybe due to escaping but have no idea how to solve the problem.
What can I do for that? Or I have to switch to a html output?
The text was updated successfully, but these errors were encountered: