khang119966 commited on
Commit
65f1afc
·
verified ·
1 Parent(s): 3ce8604

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -118,7 +118,10 @@ def chat(message, history):
118
  We currently only support one image at the start of the context! Please start a new conversation."""
119
 
120
  if len(history) == 0 and len(message["files"]) != 0:
121
- test_image = message["files"][0]
 
 
 
122
  pixel_values = load_image(test_image, max_num=6).to(torch.bfloat16).cuda()
123
  elif len(history) == 0 and len(message["files"]) == 0:
124
  pixel_values = None
@@ -226,7 +229,7 @@ button.svelte-1lcyrx4[aria-label="user's message: a file of type image/jpeg, "]
226
 
227
  demo = gr.ChatInterface(
228
  fn=chat,
229
- description="""**Vintern-1B-v3.5** is the latest in the **Vintern** series, bringing **major improvements** over v2 across all benchmarks. 🚀 Fine-tuned from **InternVL-1B-2.5**, already strong in **Vietnamese 🇻🇳 tasks** thanks to **Viet-ShareGPT-4o-Text-VQA** data, this version further enhances **Vietnamese capabilities** while retaining **strong English performance**. It excels in **OCR**, **text recognition**, and **Vietnam-specific document understanding**. 📄 However, users should be mindful of **potential biases** due to the training data. ⚠️""",
230
  examples=[{"text": "Mô tả hình ảnh.", "files":["./demo_3.jpg"]},
231
  {"text": "Trích xuất các thông tin từ ảnh trả về markdown.", "files":["./demo_1.jpg"]},
232
  {"text": "Viết một bài quảng cáo dài trên mạng xã hội cho hình ảnh.", "files":["./demo_2.jpg"]}],
 
118
  We currently only support one image at the start of the context! Please start a new conversation."""
119
 
120
  if len(history) == 0 and len(message["files"]) != 0:
121
+ if "path" in message["files"][0]:
122
+ test_image = message["files"][0]["path"]
123
+ else:
124
+ test_image = message["files"][0]
125
  pixel_values = load_image(test_image, max_num=6).to(torch.bfloat16).cuda()
126
  elif len(history) == 0 and len(message["files"]) == 0:
127
  pixel_values = None
 
229
 
230
  demo = gr.ChatInterface(
231
  fn=chat,
232
+ description="""**Vintern-1B-v3.5** is the latest in the Vintern series, bringing major improvements over v2 across all benchmarks. 🚀 Fine-tuned from **InternVL-2.5-1B**, already strong in Vietnamese 🇻🇳 tasks thanks to Viet-ShareGPT-4o-Text-VQA data, this version enhances Vietnamese capabilities while retaining strong English performance. It excels in OCR, text recognition, and Vietnam-specific document understanding. 📄 However, users should be mindful of **potential biases** due to the training data. ⚠️""",
233
  examples=[{"text": "Mô tả hình ảnh.", "files":["./demo_3.jpg"]},
234
  {"text": "Trích xuất các thông tin từ ảnh trả về markdown.", "files":["./demo_1.jpg"]},
235
  {"text": "Viết một bài quảng cáo dài trên mạng xã hội cho hình ảnh.", "files":["./demo_2.jpg"]}],