Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from feature_combiner import FeatureCombiner
|
3 |
from pipeline import Pipeline_demo
|
4 |
-
|
5 |
DATASETS = {
|
6 |
"angiography.CHUAC": "CHUAC dataset",
|
7 |
"angiography.DCA1": "DCA1 dataset",
|
@@ -17,14 +17,16 @@ JSON_FILES = {
|
|
17 |
"retina":"dataset_curvilinear/retina/retina.json"
|
18 |
}
|
19 |
|
|
|
20 |
is_cpu= True
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def generate_prompts(dataset):
|
24 |
-
|
25 |
-
根据选择的数据集生成prompts。
|
26 |
-
返回semantic map prompt和image prompt。
|
27 |
-
"""
|
28 |
|
29 |
json_index = dataset.split(".")[0]
|
30 |
json_file = JSON_FILES[json_index]
|
@@ -33,20 +35,12 @@ def generate_prompts(dataset):
|
|
33 |
return caption_seg, caption_img
|
34 |
|
35 |
def generate_semantic_map(semantic_map_prompt):
|
36 |
-
|
37 |
-
根据semantic map prompt生成semantic map。
|
38 |
-
返回semantic map的图像。
|
39 |
-
"""
|
40 |
-
# 示例函数体,你需要填充实际的图像生成逻辑
|
41 |
return pipeline_demo.generate_semantic_map(semantic_map_prompt)
|
42 |
|
43 |
|
44 |
def generate_image(image_prompt,semantic_map_image):
|
45 |
-
|
46 |
-
根据image prompt生成图像。
|
47 |
-
返回生成的图像。
|
48 |
-
"""
|
49 |
-
# 示例函数体,你需要填充实际的图像生成逻辑
|
50 |
return pipeline_demo.generate_image(image_prompt, semantic_map_image)
|
51 |
|
52 |
with gr.Blocks() as demo:
|
|
|
1 |
import gradio as gr
|
2 |
from feature_combiner import FeatureCombiner
|
3 |
from pipeline import Pipeline_demo
|
4 |
+
|
5 |
DATASETS = {
|
6 |
"angiography.CHUAC": "CHUAC dataset",
|
7 |
"angiography.DCA1": "DCA1 dataset",
|
|
|
17 |
"retina":"dataset_curvilinear/retina/retina.json"
|
18 |
}
|
19 |
|
20 |
+
############# Setting #############
|
21 |
is_cpu= True
|
22 |
+
enable_xformers_memory_efficient_attention = False
|
23 |
+
############# Setting #############
|
24 |
+
|
25 |
+
pipeline_demo = Pipeline_demo(is_cpu=is_cpu,
|
26 |
+
enable_xformers_memory_efficient_attention=enable_xformers_memory_efficient_attention)
|
27 |
|
28 |
def generate_prompts(dataset):
|
29 |
+
|
|
|
|
|
|
|
30 |
|
31 |
json_index = dataset.split(".")[0]
|
32 |
json_file = JSON_FILES[json_index]
|
|
|
35 |
return caption_seg, caption_img
|
36 |
|
37 |
def generate_semantic_map(semantic_map_prompt):
|
38 |
+
|
|
|
|
|
|
|
|
|
39 |
return pipeline_demo.generate_semantic_map(semantic_map_prompt)
|
40 |
|
41 |
|
42 |
def generate_image(image_prompt,semantic_map_image):
|
43 |
+
|
|
|
|
|
|
|
|
|
44 |
return pipeline_demo.generate_image(image_prompt, semantic_map_image)
|
45 |
|
46 |
with gr.Blocks() as demo:
|