Spaces:
Sleeping
Sleeping
修改图片的展示逻辑
Browse files- posterGn.py +17 -1
posterGn.py
CHANGED
|
@@ -57,7 +57,13 @@ def chat_stream(message, history):
|
|
| 57 |
if variable.get("name") == "img_url":
|
| 58 |
img_url = variable.get("defaultValue")
|
| 59 |
if img_url:
|
| 60 |
-
full_response = f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
print(f"\n[成功] 提取到图片URL: {img_url}", file=sys.stderr)
|
| 62 |
print(f"\n[成功] 构建的图片标签: {full_response}", file=sys.stderr)
|
| 63 |
break
|
|
@@ -71,6 +77,16 @@ def chat_stream(message, history):
|
|
| 71 |
|
| 72 |
iface = gr.ChatInterface(
|
| 73 |
chat_stream,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
chatbot=gr.Chatbot(height=800, label="提示词助手"),
|
| 75 |
textbox=gr.Textbox(placeholder="在这里输入您的消息...", container=False, scale=7),
|
| 76 |
title="米你AI 海报助手",
|
|
|
|
| 57 |
if variable.get("name") == "img_url":
|
| 58 |
img_url = variable.get("defaultValue")
|
| 59 |
if img_url:
|
| 60 |
+
full_response = f'''
|
| 61 |
+
<img src="{img_url}"
|
| 62 |
+
width="600px"
|
| 63 |
+
onclick="window.open(this.src, '_blank')"
|
| 64 |
+
style="cursor: pointer;"
|
| 65 |
+
title="点击查看大图">
|
| 66 |
+
'''
|
| 67 |
print(f"\n[成功] 提取到图片URL: {img_url}", file=sys.stderr)
|
| 68 |
print(f"\n[成功] 构建的图片标签: {full_response}", file=sys.stderr)
|
| 69 |
break
|
|
|
|
| 77 |
|
| 78 |
iface = gr.ChatInterface(
|
| 79 |
chat_stream,
|
| 80 |
+
css="""
|
| 81 |
+
.message-wrap img {
|
| 82 |
+
max-width: 600px !important;
|
| 83 |
+
height: auto !important;
|
| 84 |
+
transition: transform 0.2s;
|
| 85 |
+
}
|
| 86 |
+
.message-wrap img:hover {
|
| 87 |
+
transform: scale(1.02);
|
| 88 |
+
}
|
| 89 |
+
""",
|
| 90 |
chatbot=gr.Chatbot(height=800, label="提示词助手"),
|
| 91 |
textbox=gr.Textbox(placeholder="在这里输入您的消息...", container=False, scale=7),
|
| 92 |
title="米你AI 海报助手",
|