TalkUHulk commited on
Commit
e1604fb
·
verified ·
1 Parent(s): fb172d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -28,9 +28,9 @@ def model_inference(input_dict, history):
28
 
29
  # 处理上传的图片
30
  if len(files) > 1:
31
- images = [Image.open(f).convert("RGB") for f in files]
32
  elif len(files) == 1:
33
- images = [Image.open(files[0]).convert("RGB")]
34
  else:
35
  images = []
36
 
@@ -125,13 +125,13 @@ def model_inference(input_dict, history):
125
  examples = [
126
  [{"text": "描述图片的内容",
127
  "files": ["example_images/objects365_v1_00322846.jpg"]}],
128
- [{"text": "这张图片中有什么物体?",
129
  "files": ["example_images/objects365_v1_00361740.jpg"]}],
130
- [{"text": "图中什么交通工具?",
131
  "files": ["example_images/objects365_v1_00357438.jpg"]}],
132
- [{"text": "图片中有几只动物?",
133
  "files": ["example_images/objects365_v1_00323167.jpg"]}],
134
- [{"text": "这个地方是哪里?",
135
  "files": ["example_images/objects365_v1_00363692.jpg"]}],
136
  ]
137
 
@@ -185,7 +185,7 @@ custom_css = """
185
  demo = gr.ChatInterface(
186
  fn=model_inference,
187
  title="🎨 TinyMind 多模态AI助手",
188
- description="基于 ONNX 的高效多模态模型,支持图像理解与文本生成。上传图片并输入提示词,获得智能回答。",
189
  examples=examples,
190
  textbox=gr.MultimodalTextbox(
191
  label="📝 输入提示词(建议以图片描述为主)",
 
28
 
29
  # 处理上传的图片
30
  if len(files) > 1:
31
+ images = [Image.open(f["path"]).convert("RGB") for f in files]
32
  elif len(files) == 1:
33
+ images = [Image.open(files[0]["path"]).convert("RGB")]
34
  else:
35
  images = []
36
 
 
125
  examples = [
126
  [{"text": "描述图片的内容",
127
  "files": ["example_images/objects365_v1_00322846.jpg"]}],
128
+ [{"text": "简要概括这张图片的核心内容",
129
  "files": ["example_images/objects365_v1_00361740.jpg"]}],
130
+ [{"text": "能看到什么?",
131
  "files": ["example_images/objects365_v1_00357438.jpg"]}],
132
+ [{"text": "描述这张图片中的内容",
133
  "files": ["example_images/objects365_v1_00323167.jpg"]}],
134
+ [{"text": "图中展示了什么场景",
135
  "files": ["example_images/objects365_v1_00363692.jpg"]}],
136
  ]
137
 
 
185
  demo = gr.ChatInterface(
186
  fn=model_inference,
187
  title="🎨 TinyMind 多模态AI助手",
188
+ description="基于 ONNX 的高效多模态模型,支持图像理解与文本生成(优化中)。上传图片并输入提示词,获得智能回答。[详见知乎](https://zhuanlan.zhihu.com/p/1982031267370389720)",
189
  examples=examples,
190
  textbox=gr.MultimodalTextbox(
191
  label="📝 输入提示词(建议以图片描述为主)",