Spaces:
Running
Running
Zenith Wang
commited on
Commit
·
96f3cd9
1
Parent(s):
ac8b8e5
Remove examples section and optimize image upload UI with custom CSS
Browse files
app.py
CHANGED
|
@@ -223,7 +223,19 @@ def process_message(message, history, image, system_prompt, temperature, max_tok
|
|
| 223 |
yield history
|
| 224 |
|
| 225 |
# 创建Gradio界面
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
gr.Markdown("""
|
| 228 |
# 🤖 Step-3 Chat
|
| 229 |
|
|
@@ -255,11 +267,12 @@ with gr.Blocks(title="Step-3 Chat", theme=gr.themes.Soft()) as demo:
|
|
| 255 |
)
|
| 256 |
with gr.Column(scale=2):
|
| 257 |
image_input = gr.Image(
|
| 258 |
-
label="
|
| 259 |
type="filepath",
|
| 260 |
height=100,
|
| 261 |
interactive=True,
|
| 262 |
-
show_label=True
|
|
|
|
| 263 |
)
|
| 264 |
with gr.Column(scale=1, min_width=100):
|
| 265 |
submit_btn = gr.Button("Send", variant="primary")
|
|
@@ -304,19 +317,7 @@ with gr.Blocks(title="Step-3 Chat", theme=gr.themes.Soft()) as demo:
|
|
| 304 |
label="Top P"
|
| 305 |
)
|
| 306 |
|
| 307 |
-
|
| 308 |
-
with gr.Accordion("📝 Examples", open=False):
|
| 309 |
-
gr.Examples(
|
| 310 |
-
examples=[
|
| 311 |
-
["What is machine learning?"],
|
| 312 |
-
["Write a Python function to calculate fibonacci numbers"],
|
| 313 |
-
["Explain quantum computing in simple terms"],
|
| 314 |
-
["What are the benefits of renewable energy?"],
|
| 315 |
-
["How does blockchain technology work?"]
|
| 316 |
-
],
|
| 317 |
-
inputs=msg,
|
| 318 |
-
label=""
|
| 319 |
-
)
|
| 320 |
|
| 321 |
# 事件处理函数
|
| 322 |
def user_submit(message, history, image):
|
|
|
|
| 223 |
yield history
|
| 224 |
|
| 225 |
# 创建Gradio界面
|
| 226 |
+
css = """
|
| 227 |
+
.compact-image .wrap {
|
| 228 |
+
font-size: 12px !important;
|
| 229 |
+
}
|
| 230 |
+
.compact-image .upload-container {
|
| 231 |
+
min-height: 80px !important;
|
| 232 |
+
}
|
| 233 |
+
.compact-image .wrap .or {
|
| 234 |
+
display: none !important;
|
| 235 |
+
}
|
| 236 |
+
"""
|
| 237 |
+
|
| 238 |
+
with gr.Blocks(title="Step-3 Chat", theme=gr.themes.Soft(), css=css) as demo:
|
| 239 |
gr.Markdown("""
|
| 240 |
# 🤖 Step-3 Chat
|
| 241 |
|
|
|
|
| 267 |
)
|
| 268 |
with gr.Column(scale=2):
|
| 269 |
image_input = gr.Image(
|
| 270 |
+
label="Image",
|
| 271 |
type="filepath",
|
| 272 |
height=100,
|
| 273 |
interactive=True,
|
| 274 |
+
show_label=True,
|
| 275 |
+
elem_classes="compact-image"
|
| 276 |
)
|
| 277 |
with gr.Column(scale=1, min_width=100):
|
| 278 |
submit_btn = gr.Button("Send", variant="primary")
|
|
|
|
| 317 |
label="Top P"
|
| 318 |
)
|
| 319 |
|
| 320 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
# 事件处理函数
|
| 323 |
def user_submit(message, history, image):
|