Spaces:
Sleeping
Sleeping
ikeda
commited on
Commit
·
b8a5709
1
Parent(s):
1c5bad2
add Historic Site Card Creation to not only Japanese but other languages version.
Browse files(But other languages version can't configure Mark(Designation Type) because there are no Mark(Designation Type) images for other languages.)
app.py
CHANGED
@@ -85,28 +85,33 @@ with gr.Blocks() as demo:
|
|
85 |
outputs=[gr.Model3D(camera_position=(90, 90, 5))]
|
86 |
)
|
87 |
|
88 |
-
|
89 |
-
with gr.
|
90 |
-
with gr.
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
demo.launch()
|
|
|
85 |
outputs=[gr.Model3D(camera_position=(90, 90, 5))]
|
86 |
)
|
87 |
|
88 |
+
with gr.Tab(display_message_dict['tab_label_historic_site_card']):
|
89 |
+
with gr.Row():
|
90 |
+
with gr.Column():
|
91 |
+
title = gr.Textbox(label=display_message_dict['label_title'], placeholder=display_message_dict['placeholder_title'])
|
92 |
+
color = gr.Radio([(color_dict[key], key) for key in color_dict], value=list(color_dict)[0], label=display_message_dict['label_color'])
|
93 |
+
|
94 |
+
# Mark(Designation Type) is only visible for Japanese(Because there are no Designation Type Images for other languages).
|
95 |
+
# In other languages, mark is only 'No Designation'(No Designation Type Image).
|
96 |
+
is_mark_visible = True if language == 'ja' else False
|
97 |
+
mark = gr.Radio(display_message_dict['mark_list'], visible=is_mark_visible,
|
98 |
+
value=list(display_message_dict['mark_list'])[len(display_message_dict['mark_list'])-1], label=display_message_dict['label_mark'])
|
99 |
+
|
100 |
+
historic_site_type = gr.Textbox(label=display_message_dict["label_historic_site_type"], placeholder=display_message_dict["placeholder_historic_site_type"])
|
101 |
+
with gr.Column():
|
102 |
+
difficulty = gr.Slider(1, 5, 3, step=1, label=display_message_dict['label_difficulty'])
|
103 |
+
description = gr.Textbox(lines=2, label=display_message_dict['label_description'], placeholder=display_message_dict['placeholder_description'])
|
104 |
+
is_thick = gr.Checkbox(label=display_message_dict['label_is_thick'], value=False, info=display_message_dict['info_is_thick'])
|
105 |
+
image = gr.ImageEditor(image_mode='RGB', sources="upload", type="pil", crop_size="1:1", label=display_message_dict['label_image'])
|
106 |
+
|
107 |
+
button = gr.Button(display_message_dict['label_button'])
|
108 |
+
button.click(
|
109 |
+
fn=lambda title, color, mark, historic_site_type, difficulty, description, is_thick, image:
|
110 |
+
create_3dmodel('1', title, color, mark, historic_site_type, difficulty, description, is_thick, image),
|
111 |
+
inputs=[title, color, mark, historic_site_type, difficulty, description, is_thick, image],
|
112 |
+
outputs=[gr.Model3D(camera_position=(90, 90, 5))]
|
113 |
+
)
|
114 |
+
|
115 |
+
gr.Markdown(display_message_dict['footer_historic_site_card'])
|
116 |
|
117 |
demo.launch()
|