Gary3410 commited on
Commit
7d3ee9f
·
1 Parent(s): 337542b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -88,16 +88,17 @@ def create_instruct_demo():
88
  with gr.Column():
89
  outputs = gr.Textbox(lines=20, label="Output")
90
 
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(
@@ -107,9 +108,7 @@ def create_instruct_demo():
107
  fn=instruct_generate,
108
  cache_examples=os.getenv('SYSTEM') == 'spaces'
109
  )
110
- for example_one in examples:
111
- scene_name = os.path.basename(example_one[0]).split(".")[0]
112
- example_one[2] = example_dict[scene_name]["input"]
113
  run_botton.click(fn=instruct_generate, inputs=inputs, outputs=outputs)
114
  return instruct_demo
115
 
 
88
  with gr.Column():
89
  outputs = gr.Textbox(lines=20, label="Output")
90
 
91
+ # inputs = [scene_img, instruction, object_list, max_len, temp, top_k]
92
+ inputs = [scene_img, instruction, object_list]
93
 
94
  # 接下来设定具体的example格式
95
  examples_img_list = glob.glob("caption_demo/*.png")
96
  examples = []
97
  for example_img_one in examples_img_list:
98
  scene_name = os.path.basename(example_img_one).split(".")[0]
99
+ example_object_list = example_dict[scene_name]["input"]
100
  example_instruction = example_dict[scene_name]["instruction"]
101
+ example_one = [example_img_one, example_instruction, example_object_list]
102
  examples.append(example_one)
103
 
104
  gr.Examples(
 
108
  fn=instruct_generate,
109
  cache_examples=os.getenv('SYSTEM') == 'spaces'
110
  )
111
+ inputs = inputs + [max_len, temp, top_k]
 
 
112
  run_botton.click(fn=instruct_generate, inputs=inputs, outputs=outputs)
113
  return instruct_demo
114