doubility123 commited on
Commit
fe85f8c
·
1 Parent(s): a27b3f8
app.py CHANGED
@@ -16,7 +16,7 @@
16
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
-
20
  # -*- coding:utf-8 -*-
21
  from argparse import ArgumentParser
22
 
@@ -573,8 +573,11 @@ def build_demo(args):
573
 
574
  def format_examples(examples_list):
575
  examples = []
 
 
 
576
  for images, texts in examples_list:
577
- examples.append([images, display_example(images), texts])
578
 
579
  return examples
580
 
 
16
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+ import os.path
20
  # -*- coding:utf-8 -*-
21
  from argparse import ArgumentParser
22
 
 
573
 
574
  def format_examples(examples_list):
575
  examples = []
576
+ current_dir = os.path.dirname(os.path.abspath(__file__))
577
+ print(current_dir)
578
+ print(os.listdir(os.path.join(current_dir, "images")))
579
  for images, texts in examples_list:
580
+ examples.append([images, display_example(images, current_dir), texts])
581
 
582
  return examples
583
 
deepseek_vl2/serve/app_modules/utils.py CHANGED
@@ -313,9 +313,12 @@ def parse_ref_bbox(response, image: Image.Image):
313
  return None
314
 
315
 
316
- def display_example(image_list):
317
  images_html = ""
318
  for i, img_path in enumerate(image_list):
 
 
 
319
  image = Image.open(img_path)
320
  buffered = io.BytesIO()
321
  image.save(buffered, format="PNG", quality=100)
 
313
  return None
314
 
315
 
316
+ def display_example(image_list, root_dir):
317
  images_html = ""
318
  for i, img_path in enumerate(image_list):
319
+ if root_dir is not None:
320
+ img_path = os.path.join(root_dir, img_path)
321
+
322
  image = Image.open(img_path)
323
  buffered = io.BytesIO()
324
  image.save(buffered, format="PNG", quality=100)