Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -148,46 +148,14 @@ def predict(image):
|
|
148 |
except Exception as e:
|
149 |
return "Error", f"Terjadi kesalahan: {str(e)}", []
|
150 |
|
151 |
-
# Custom CSS untuk menyembunyikan elemen yang tidak diinginkan pada gr.Image
|
152 |
-
custom_css = """
|
153 |
-
.gradio-container .image-upload-container > div:nth-child(2),
|
154 |
-
.gradio-container .image-upload-container > div:nth-child(3) {
|
155 |
-
display: none !important;
|
156 |
-
}
|
157 |
-
.gradio-container .image-upload-container {
|
158 |
-
display: flex !important;
|
159 |
-
justify-content: center !important;
|
160 |
-
align-items: center !important;
|
161 |
-
min-height: 100px !important; /* Sesuaikan tinggi sesuai kebutuhan */
|
162 |
-
border-radius: 5px !important;
|
163 |
-
border: 1px dashed var(--border-color-primary) !important;
|
164 |
-
background-color: var(--input-background-fill) !important;
|
165 |
-
}
|
166 |
-
.gradio-container .image-upload-container > label {
|
167 |
-
display: flex !important;
|
168 |
-
justify-content: center !important;
|
169 |
-
align-items: center !important;
|
170 |
-
width: 100% !important;
|
171 |
-
height: 100% !important;
|
172 |
-
color: var(--body-text-color-subdued) !important;
|
173 |
-
cursor: pointer !important;
|
174 |
-
}
|
175 |
-
.gradio-container .image-upload-container > label > span {
|
176 |
-
padding: 10px 20px !important;
|
177 |
-
border-radius: 5px !important;
|
178 |
-
background-color: var(--button-primary-background-fill) !important;
|
179 |
-
color: var(--button-primary-text-color) !important;
|
180 |
-
}
|
181 |
-
"""
|
182 |
-
|
183 |
# Gradio Interface
|
184 |
-
with gr.Blocks(theme=gr.themes.Soft()
|
185 |
gr.Markdown("# Program Rekomendasi Kacamata Berdasarkan Bentuk Wajah")
|
186 |
gr.Markdown("Upload foto wajahmu untuk mendapatkan rekomendasi bentuk kacamata yang sesuai.")
|
187 |
|
188 |
with gr.Row():
|
189 |
with gr.Column():
|
190 |
-
image_input = gr.Image(type="pil"
|
191 |
confirm_button = gr.Button("Konfirmasi")
|
192 |
restart_button = gr.Button("Restart")
|
193 |
with gr.Column():
|
|
|
148 |
except Exception as e:
|
149 |
return "Error", f"Terjadi kesalahan: {str(e)}", []
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
# Gradio Interface
|
152 |
+
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
153 |
gr.Markdown("# Program Rekomendasi Kacamata Berdasarkan Bentuk Wajah")
|
154 |
gr.Markdown("Upload foto wajahmu untuk mendapatkan rekomendasi bentuk kacamata yang sesuai.")
|
155 |
|
156 |
with gr.Row():
|
157 |
with gr.Column():
|
158 |
+
image_input = gr.Image(type="pil")
|
159 |
confirm_button = gr.Button("Konfirmasi")
|
160 |
restart_button = gr.Button("Restart")
|
161 |
with gr.Column():
|