louis-she / gradio-log

A Gradio component designed to continuously show any logs.
25 stars 2 forks source link

how to set the Log's min height and max height? #1

Open yiya1989 opened 4 months ago

yiya1989 commented 4 months ago

Like the screenshot, I want to set the height: 336px to height: 800px or the xterm auto fix the height, how can I do? Thanks! image

yiya1989 commented 4 months ago

哈哈。发现老哥是中国人啊,就是想请教下,我再Log 里面可以设置固定高度或者自适应高度吗。。默认的有点太矮了

SebastianKohler commented 3 months ago

You can set an id-attribute on the component HTML using the elem_id property on the Log class:

Log("log_file.log", elem_id="gradio-log-comp-id")

And then add the CSS styling to the Gradio Blocks class using the css property:

import gradio as gr

with gr.Blocks(css="#gradio-log-comp-id {min-height: 200px; max-height: 800px}") as demo:
   # your Gradio components

I think the Interface class also has the css property.

louis-she commented 6 days ago

@yiya1989 这个不是代码写死的,前端直接用了 Gradio 的 Block,应该是撑满 gr.Row 的高度才对。你可以试试通过 gr.Row 的参数来调整高度:

https://www.gradio.app/docs/gradio/row