Skip to content
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

Allow Gradio apps to take up more (full screen?) width #8201

Open
abidlabs opened this issue May 3, 2024 · 1 comment
Open

Allow Gradio apps to take up more (full screen?) width #8201

abidlabs opened this issue May 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@abidlabs
Copy link
Member

abidlabs commented May 3, 2024

A common request is to increase the width of Gradio apps so that there's more space for the components and less white space around the edges of the app. While this can be done with custom css, it'd be good to have a built-in parameter in Gradio for this:

Quoting @yvrjsharma:

This is particularly relevant for arena-type demos, where multiple (>= two) chatbots are present in the UI, allowing for easy comparisons. These types of demos have become quite popular recently, with the success of lmsys-arena, and I think we might see an increase in their numbers in the near future. For example: https://huggingface.co/spaces/WildVision/vision-arena

@abidlabs abidlabs added the enhancement New feature or request label May 3, 2024
@one-lithe-rune
Copy link

In case it's useful to anyone trying to do this, the code I'm currently using make things full width for Blocks is similar to this:

import gradio as gr

# Change the @media query to whatever min-width you need

head_style = """
<style>
@media (min-width: 1536px)
{
    .gradio-container {
        min-width: var(--size-full) !important;
    }
}
</style>
"""

# It has to go in head=

with gr.Blocks(
    title="A chat interface",
    head=head_style,
) as chat_interface:

# ...etc.

Note that it has to go in head, as putting it in CSS didn't work on the version of gradio I was working with at the time I was trying to do this, at least with the @media query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants