Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -31,8 +31,7 @@ def preprocess_image(image):
|
|
31 |
|
32 |
return image
|
33 |
|
34 |
-
#
|
35 |
-
pil_image = preprocess_image(pil_image)
|
36 |
|
37 |
def patched_json_schema(schema, defs=None):
|
38 |
# Handle boolean schema directly
|
@@ -197,9 +196,8 @@ def caption_image(image, model_name=default_caption_model):
|
|
197 |
print(f"Unexpected image type: {type(image)}")
|
198 |
return "Error: Unsupported image type"
|
199 |
|
200 |
-
#
|
201 |
-
|
202 |
-
pil_image = pil_image.convert("RGB")
|
203 |
|
204 |
# Check if model is available
|
205 |
if model_name not in models or model_name not in processors:
|
@@ -316,7 +314,6 @@ custom_css = """
|
|
316 |
.gradio-container {
|
317 |
max-width: 1200px !important;
|
318 |
}
|
319 |
-
|
320 |
.main-header {
|
321 |
text-align: center;
|
322 |
margin-bottom: 1rem;
|
@@ -327,27 +324,23 @@ custom_css = """
|
|
327 |
-webkit-text-fill-color: transparent;
|
328 |
padding: 0.5rem;
|
329 |
}
|
330 |
-
|
331 |
.tagline {
|
332 |
text-align: center;
|
333 |
font-size: 1.2rem;
|
334 |
margin-bottom: 2rem;
|
335 |
color: #4b5563;
|
336 |
}
|
337 |
-
|
338 |
.image-preview {
|
339 |
border-radius: 12px;
|
340 |
overflow: hidden;
|
341 |
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
342 |
}
|
343 |
-
|
344 |
.panel-box {
|
345 |
border-radius: 12px;
|
346 |
background-color: rgba(255, 255, 255, 0.8);
|
347 |
padding: 1rem;
|
348 |
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
349 |
}
|
350 |
-
|
351 |
.control-panel {
|
352 |
padding: 1rem;
|
353 |
border-radius: 12px;
|
@@ -355,26 +348,22 @@ custom_css = """
|
|
355 |
margin-bottom: 1rem;
|
356 |
border: 1px solid #e2e8f0;
|
357 |
}
|
358 |
-
|
359 |
.section-header {
|
360 |
font-weight: 600;
|
361 |
font-size: 1.1rem;
|
362 |
margin-bottom: 0.5rem;
|
363 |
color: #4338ca;
|
364 |
}
|
365 |
-
|
366 |
.transform-button {
|
367 |
font-weight: 600 !important;
|
368 |
margin-top: 1rem !important;
|
369 |
}
|
370 |
-
|
371 |
.footer {
|
372 |
text-align: center;
|
373 |
color: #6b7280;
|
374 |
margin-top: 2rem;
|
375 |
font-size: 0.9rem;
|
376 |
}
|
377 |
-
|
378 |
.output-panel {
|
379 |
background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
|
380 |
border-radius: 12px;
|
|
|
31 |
|
32 |
return image
|
33 |
|
34 |
+
# REMOVE THIS LINE: pil_image = preprocess_image(pil_image)
|
|
|
35 |
|
36 |
def patched_json_schema(schema, defs=None):
|
37 |
# Handle boolean schema directly
|
|
|
196 |
print(f"Unexpected image type: {type(image)}")
|
197 |
return "Error: Unsupported image type"
|
198 |
|
199 |
+
# Apply preprocessing to the PIL image (use the preprocess_image function here)
|
200 |
+
pil_image = preprocess_image(pil_image)
|
|
|
201 |
|
202 |
# Check if model is available
|
203 |
if model_name not in models or model_name not in processors:
|
|
|
314 |
.gradio-container {
|
315 |
max-width: 1200px !important;
|
316 |
}
|
|
|
317 |
.main-header {
|
318 |
text-align: center;
|
319 |
margin-bottom: 1rem;
|
|
|
324 |
-webkit-text-fill-color: transparent;
|
325 |
padding: 0.5rem;
|
326 |
}
|
|
|
327 |
.tagline {
|
328 |
text-align: center;
|
329 |
font-size: 1.2rem;
|
330 |
margin-bottom: 2rem;
|
331 |
color: #4b5563;
|
332 |
}
|
|
|
333 |
.image-preview {
|
334 |
border-radius: 12px;
|
335 |
overflow: hidden;
|
336 |
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
337 |
}
|
|
|
338 |
.panel-box {
|
339 |
border-radius: 12px;
|
340 |
background-color: rgba(255, 255, 255, 0.8);
|
341 |
padding: 1rem;
|
342 |
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
343 |
}
|
|
|
344 |
.control-panel {
|
345 |
padding: 1rem;
|
346 |
border-radius: 12px;
|
|
|
348 |
margin-bottom: 1rem;
|
349 |
border: 1px solid #e2e8f0;
|
350 |
}
|
|
|
351 |
.section-header {
|
352 |
font-weight: 600;
|
353 |
font-size: 1.1rem;
|
354 |
margin-bottom: 0.5rem;
|
355 |
color: #4338ca;
|
356 |
}
|
|
|
357 |
.transform-button {
|
358 |
font-weight: 600 !important;
|
359 |
margin-top: 1rem !important;
|
360 |
}
|
|
|
361 |
.footer {
|
362 |
text-align: center;
|
363 |
color: #6b7280;
|
364 |
margin-top: 2rem;
|
365 |
font-size: 0.9rem;
|
366 |
}
|
|
|
367 |
.output-panel {
|
368 |
background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
|
369 |
border-radius: 12px;
|