Spaces:
Running
Running
update
Browse files
app.py
CHANGED
@@ -155,6 +155,11 @@ def history_render(history: History):
|
|
155 |
def clear_history():
|
156 |
return []
|
157 |
|
|
|
|
|
|
|
|
|
|
|
158 |
def process_image_for_model(image):
|
159 |
"""Convert image to base64 for model input"""
|
160 |
if image is None:
|
@@ -281,7 +286,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
281 |
current_model_display = gr.Markdown("**Current Model:** DeepSeek V3", visible=False)
|
282 |
input = antd.InputTextarea(
|
283 |
size="large", allow_clear=True, placeholder="Please enter what kind of application you want", visible=False)
|
284 |
-
image_input = gr.Image(label="Upload an image (
|
285 |
btn = antd.Button("send", type="primary", size="large", visible=False)
|
286 |
clear_btn = antd.Button("clear history", type="default", size="large", visible=False)
|
287 |
|
@@ -316,7 +321,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
316 |
for i, model in enumerate(AVAILABLE_MODELS):
|
317 |
with antd.Card(hoverable=True, title=model["name"]) as modelCard:
|
318 |
antd.CardMeta(description=model["description"])
|
319 |
-
modelCard.click(lambda m=model: (m, gr.update(open=False), f"**Current Model:** {m['name']}"), outputs=[current_model, model_modal, current_model_display])
|
320 |
|
321 |
modelBtn.click(lambda: gr.update(open=True), inputs=[], outputs=[model_modal])
|
322 |
|
@@ -366,7 +371,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
366 |
return (
|
367 |
gr.update(visible=False),
|
368 |
gr.update(visible=True),
|
369 |
-
gr.update(visible=
|
370 |
gr.update(visible=True),
|
371 |
gr.update(visible=True),
|
372 |
gr.update(visible=True),
|
|
|
155 |
def clear_history():
|
156 |
return []
|
157 |
|
158 |
+
def update_image_input_visibility(model):
|
159 |
+
"""Update image input visibility based on selected model"""
|
160 |
+
is_ernie_vl = model.get("id") == "baidu/ERNIE-4.5-VL-424B-A47B-Base-PT"
|
161 |
+
return gr.update(visible=is_ernie_vl)
|
162 |
+
|
163 |
def process_image_for_model(image):
|
164 |
"""Convert image to base64 for model input"""
|
165 |
if image is None:
|
|
|
286 |
current_model_display = gr.Markdown("**Current Model:** DeepSeek V3", visible=False)
|
287 |
input = antd.InputTextarea(
|
288 |
size="large", allow_clear=True, placeholder="Please enter what kind of application you want", visible=False)
|
289 |
+
image_input = gr.Image(label="Upload an image (only for ERNIE-4.5-VL model)", visible=False)
|
290 |
btn = antd.Button("send", type="primary", size="large", visible=False)
|
291 |
clear_btn = antd.Button("clear history", type="default", size="large", visible=False)
|
292 |
|
|
|
321 |
for i, model in enumerate(AVAILABLE_MODELS):
|
322 |
with antd.Card(hoverable=True, title=model["name"]) as modelCard:
|
323 |
antd.CardMeta(description=model["description"])
|
324 |
+
modelCard.click(lambda m=model: (m, gr.update(open=False), f"**Current Model:** {m['name']}", update_image_input_visibility(m)), outputs=[current_model, model_modal, current_model_display, image_input])
|
325 |
|
326 |
modelBtn.click(lambda: gr.update(open=True), inputs=[], outputs=[model_modal])
|
327 |
|
|
|
371 |
return (
|
372 |
gr.update(visible=False),
|
373 |
gr.update(visible=True),
|
374 |
+
gr.update(visible=False), # Image input hidden by default (DeepSeek V3)
|
375 |
gr.update(visible=True),
|
376 |
gr.update(visible=True),
|
377 |
gr.update(visible=True),
|