Update app.py
Browse files
app.py
CHANGED
@@ -97,48 +97,55 @@ def process_images(left_img, right_img, method, color_method):
|
|
97 |
|
98 |
# Create the Gradio interface
|
99 |
with gr.Blocks(title="3D Image Generator") as app:
|
100 |
-
gr.
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
with gr.
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
-
gr.Markdown("""
|
130 |
-
### Methods:
|
131 |
-
- **anaglyph**: Creates a red-cyan 3D image (requires 3D glasses)
|
132 |
-
- **parallel**: Creates side-by-side images for parallel viewing
|
133 |
-
- **crossed**: Creates side-by-side images for cross-eyed viewing
|
134 |
|
135 |
-
### Color Methods:
|
136 |
-
- **optimized**: Best for most images (default)
|
137 |
-
- **true**: True color anaglyph
|
138 |
-
- **mono**: Monochrome output
|
139 |
-
- **color**: Full color (may cause ghosting)
|
140 |
-
- **halfcolor**: Balance between color and depth
|
141 |
-
""")
|
142 |
|
143 |
generate_btn.click(
|
144 |
fn=process_images,
|
|
|
97 |
|
98 |
# Create the Gradio interface
|
99 |
with gr.Blocks(title="3D Image Generator") as app:
|
100 |
+
with gr.Column():
|
101 |
+
gr.Markdown("# 3D Image Generator")
|
102 |
+
gr.Markdown("Upload left and right images to create 3D images using different methods.")
|
103 |
+
|
104 |
+
with gr.Row():
|
105 |
+
with gr.Column():
|
106 |
+
|
107 |
+
|
108 |
+
with gr.Row():
|
109 |
+
with gr.Column():
|
110 |
+
left_input = gr.Image(label="Left Image")
|
111 |
+
with gr.Column():
|
112 |
+
right_input = gr.Image(label="Right Image")
|
113 |
+
|
114 |
+
with gr.Row():
|
115 |
+
with gr.Column():
|
116 |
+
method = gr.Radio(
|
117 |
+
["anaglyph", "parallel", "crossed"],
|
118 |
+
label="Method",
|
119 |
+
value="anaglyph",
|
120 |
+
info="Select the 3D image creation method"
|
121 |
+
)
|
122 |
+
with gr.Column():
|
123 |
+
color_method = gr.Radio(
|
124 |
+
["optimized", "true", "mono", "color", "halfcolor"],
|
125 |
+
label="Color Method",
|
126 |
+
value="optimized",
|
127 |
+
info="Select the color processing method"
|
128 |
+
)
|
129 |
+
|
130 |
+
generate_btn = gr.Button("Generate 3D Image", variant="primary")
|
131 |
+
|
132 |
+
gr.Markdown("""
|
133 |
+
### Methods:
|
134 |
+
- **anaglyph**: Creates a red-cyan 3D image (requires 3D glasses)
|
135 |
+
- **parallel**: Creates side-by-side images for parallel viewing
|
136 |
+
- **crossed**: Creates side-by-side images for cross-eyed viewing
|
137 |
+
|
138 |
+
### Color Methods:
|
139 |
+
- **optimized**: Best for most images (default)
|
140 |
+
- **true**: True color anaglyph
|
141 |
+
- **mono**: Monochrome output
|
142 |
+
- **color**: Full color (may cause ghosting)
|
143 |
+
- **halfcolor**: Balance between color and depth
|
144 |
+
""")
|
145 |
+
|
146 |
+
output = gr.Image(label="Generated 3D Image")
|
147 |
|
|
|
|
|
|
|
|
|
|
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
generate_btn.click(
|
151 |
fn=process_images,
|