Spaces:
Running
Running
feat: stretch chat window to window height
Browse files
app.py
CHANGED
|
@@ -323,7 +323,13 @@ def chat(message, history):
|
|
| 323 |
yield f"{text}\n\n{ERROR_MESSAGE}" if text else ERROR_MESSAGE
|
| 324 |
|
| 325 |
|
| 326 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
# ββ Logo + Header + Logout ββββββββββββββββββββββββββββββββ
|
| 328 |
|
| 329 |
|
|
@@ -362,8 +368,16 @@ with gr.Blocks(css_paths=["static/deval.css"],theme = gr.themes.Default(primary_
|
|
| 362 |
type="messages",
|
| 363 |
multimodal=MULTIMODAL,
|
| 364 |
textbox=upload_textbox,
|
| 365 |
-
# ChatInterface would otherwise label the transcript "Chatbot"
|
| 366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
editable=True,
|
| 368 |
concurrency_limit=20,
|
| 369 |
save_history=True,
|
|
|
|
| 323 |
yield f"{text}\n\n{ERROR_MESSAGE}" if text else ERROR_MESSAGE
|
| 324 |
|
| 325 |
|
| 326 |
+
with gr.Blocks(
|
| 327 |
+
css_paths=["static/deval.css"],
|
| 328 |
+
theme=gr.themes.Default(primary_hue="blue", secondary_hue="yellow"),
|
| 329 |
+
# grow top-level children with scale >= 1 to the window height; the header row
|
| 330 |
+
# and the input group have no scale, so only the transcript stretches
|
| 331 |
+
fill_height=True,
|
| 332 |
+
) as demo:
|
| 333 |
# ββ Logo + Header + Logout ββββββββββββββββββββββββββββββββ
|
| 334 |
|
| 335 |
|
|
|
|
| 368 |
type="messages",
|
| 369 |
multimodal=MULTIMODAL,
|
| 370 |
textbox=upload_textbox,
|
| 371 |
+
# ChatInterface would otherwise label the transcript "Chatbot". scale=1 is
|
| 372 |
+
# what makes fill_height stretch it: 400px is the floor it grows from, so
|
| 373 |
+
# the transcript takes the window height left over by header and input.
|
| 374 |
+
chatbot=gr.Chatbot(
|
| 375 |
+
type="messages",
|
| 376 |
+
show_label=False,
|
| 377 |
+
scale=1,
|
| 378 |
+
height=400,
|
| 379 |
+
elem_id="chat-window",
|
| 380 |
+
),
|
| 381 |
editable=True,
|
| 382 |
concurrency_limit=20,
|
| 383 |
save_history=True,
|