Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,8 @@ def instruct_generate(
|
|
43 |
temperature: A value controlling the randomness of the sampling process. Higher values result in more random
|
44 |
"""
|
45 |
# scene_name = os.path.basename(img_path).split(".")[0]
|
46 |
-
|
47 |
-
|
48 |
if "..." in input:
|
49 |
input = input.replace("...", "")
|
50 |
output = [prompt, input, max_new_tokens, top_k, temperature]
|
@@ -61,9 +61,10 @@ max_batch_size = 1
|
|
61 |
with open(example_path, 'r') as f:
|
62 |
content = f.read()
|
63 |
example_dict = json.loads(content)
|
64 |
-
|
65 |
for scene_id, scene_dict in example_dict.items():
|
66 |
-
|
|
|
67 |
|
68 |
def create_instruct_demo():
|
69 |
with gr.Blocks() as instruct_demo:
|
@@ -90,7 +91,6 @@ def create_instruct_demo():
|
|
90 |
inputs = [scene_img, instruction, object_list, max_len, top_k, temp]
|
91 |
|
92 |
# 接下来设定具体的example格式
|
93 |
-
examples_img_list = glob.glob("caption_demo/*.png")
|
94 |
examples = []
|
95 |
for example_img_one in examples_img_list:
|
96 |
scene_name = os.path.basename(example_img_one).split(".")[0]
|
|
|
43 |
temperature: A value controlling the randomness of the sampling process. Higher values result in more random
|
44 |
"""
|
45 |
# scene_name = os.path.basename(img_path).split(".")[0]
|
46 |
+
if input in input_value_2_real.keys():
|
47 |
+
input = input_value_2_real[input]
|
48 |
if "..." in input:
|
49 |
input = input.replace("...", "")
|
50 |
output = [prompt, input, max_new_tokens, top_k, temperature]
|
|
|
61 |
with open(example_path, 'r') as f:
|
62 |
content = f.read()
|
63 |
example_dict = json.loads(content)
|
64 |
+
input_value_2_real = {}
|
65 |
for scene_id, scene_dict in example_dict.items():
|
66 |
+
input_value_2_real[scene_dict["input_display"]] = scene_dict["input"]
|
67 |
+
examples_img_list = glob.glob("caption_demo/*.png")
|
68 |
|
69 |
def create_instruct_demo():
|
70 |
with gr.Blocks() as instruct_demo:
|
|
|
91 |
inputs = [scene_img, instruction, object_list, max_len, top_k, temp]
|
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]
|