Gary3410 commited on
Commit
9a958bb
·
1 Parent(s): fe695a6

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -70,13 +70,13 @@ def create_instruct_demo():
70
  with gr.Blocks() as instruct_demo:
71
  with gr.Row():
72
  with gr.Column():
73
- scene_img = gr.Image(label='Scene', type='filepath')
74
  instruction = gr.Textbox(
75
  lines=2, label="Instruction")
76
  object_list = gr.Textbox(
77
  lines=5, label="Input")
78
- max_len = gr.Slider(minimum=1, maximum=512,
79
- value=128, label="Max length")
80
  with gr.Accordion(label='Advanced options', open=False):
81
  temp = gr.Slider(minimum=0, maximum=1,
82
  value=0.8, label="Temperature")
@@ -91,12 +91,13 @@ def create_instruct_demo():
91
  inputs = [scene_img, instruction, object_list, max_len, temp, top_k]
92
 
93
  # 接下来设定具体的example格式
 
94
  examples = []
95
  for example_img_one in examples_img_list:
96
  scene_name = os.path.basename(example_img_one).split(".")[0]
97
  example_object_list = example_dict[scene_name]["input_display"]
98
  example_instruction = example_dict[scene_name]["instruction"]
99
- example_one = [example_img_one, example_instruction, example_object_list, 512, 0.8, 200]
100
  examples.append(example_one)
101
 
102
  gr.Examples(
 
70
  with gr.Blocks() as instruct_demo:
71
  with gr.Row():
72
  with gr.Column():
73
+ scene_img = gr.Image(label='Scene', type='filepath', interactive=False)
74
  instruction = gr.Textbox(
75
  lines=2, label="Instruction")
76
  object_list = gr.Textbox(
77
  lines=5, label="Input")
78
+ max_len = gr.Slider(minimum=256, maximum=1024,
79
+ value=512, label="Max length")
80
  with gr.Accordion(label='Advanced options', open=False):
81
  temp = gr.Slider(minimum=0, maximum=1,
82
  value=0.8, label="Temperature")
 
91
  inputs = [scene_img, instruction, object_list, max_len, temp, top_k]
92
 
93
  # 接下来设定具体的example格式
94
+ examples_img_list = glob.glob("caption_demo/*.png")
95
  examples = []
96
  for example_img_one in examples_img_list:
97
  scene_name = os.path.basename(example_img_one).split(".")[0]
98
  example_object_list = example_dict[scene_name]["input_display"]
99
  example_instruction = example_dict[scene_name]["instruction"]
100
+ example_one = [example_img_one, example_instruction, example_object_list, 1024, 0.8, 200]
101
  examples.append(example_one)
102
 
103
  gr.Examples(