zhang-ziang commited on
Commit
e1a7ab3
1 Parent(s): 00fe360
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  from paths import *
3
-
4
  from vision_tower import DINOv2_MLP
5
  from transformers import AutoImageProcessor
6
  import torch
@@ -51,9 +51,14 @@ def infer_func(img, do_rm_bkg, do_infer_aug):
51
  # axis_model = "axis.obj"
52
  return [res_img, round(float(angles[0]), 2), round(float(angles[1]), 2), round(float(angles[2]), 2), round(float(angles[3]), 2)]
53
 
 
 
 
 
54
  server = gr.Interface(
55
  flagging_mode='never',
56
- fn=infer_func,
 
57
  inputs=[
58
  gr.Image(height=512, width=512, label="upload your image"),
59
  gr.Checkbox(label="Remove Background", value=True),
 
1
  import gradio as gr
2
  from paths import *
3
+ import os
4
  from vision_tower import DINOv2_MLP
5
  from transformers import AutoImageProcessor
6
  import torch
 
51
  # axis_model = "axis.obj"
52
  return [res_img, round(float(angles[0]), 2), round(float(angles[1]), 2), round(float(angles[2]), 2), round(float(angles[3]), 2)]
53
 
54
+ example_files = os.listdir('examples')
55
+ example_files.sort()
56
+ example_files = [[os.path.join('examples', filename), None, None] for filename in example_files]
57
+
58
  server = gr.Interface(
59
  flagging_mode='never',
60
+ fn=infer_func,
61
+ examples=example_files,
62
  inputs=[
63
  gr.Image(height=512, width=512, label="upload your image"),
64
  gr.Checkbox(label="Remove Background", value=True),
examples/car.jpg ADDED
examples/cat.png ADDED
examples/iMAC.jpg ADDED
examples/pig.jpg ADDED
examples/statue.png ADDED