Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -343,7 +343,28 @@ def analyze_outfit(input_img: Image.Image):
|
|
| 343 |
return category_html, None, f"Analysis complete ({category_label}), but error generating audio/response."
|
| 344 |
|
| 345 |
# --- Elite Fashion / Techno CSS (Keep your existing CSS) ---
|
| 346 |
-
custom_css = """:root { --primary-bg-color: #000000; --secondary-bg-color: #1A1A1A; --text-color: #FFFFFF; --accent-color: #1F04FF; --border-color: #333333; --input-bg-color: #1A1A1A; --button-text-color: #FFFFFF; --body-text-size: 16px; } body,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
.result-score {
|
| 348 |
color: var(--text-color) !important;
|
| 349 |
font-size: 1.1em;
|
|
@@ -351,6 +372,22 @@ custom_css = """:root { --primary-bg-color: #000000; --secondary-bg-color: #1A1A
|
|
| 351 |
margin-bottom: 5px; /* Add space below score */
|
| 352 |
}
|
| 353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
.result-error {
|
| 355 |
color: #FFAAAA !important; /* Example error color */
|
| 356 |
font-size: 0.9em;
|
|
@@ -358,33 +395,31 @@ custom_css = """:root { --primary-bg-color: #000000; --secondary-bg-color: #1A1A
|
|
| 358 |
}"""
|
| 359 |
|
| 360 |
# --- Gradio Interface (Using the custom CSS) ---
|
| 361 |
-
with gr.Blocks(css=custom_css, theme=gr.themes.
|
| 362 |
-
gr.Markdown("<h1>💧 DripAI: Rate Your Fit 💧</h1>")
|
|
|
|
|
|
|
| 363 |
with gr.Row():
|
| 364 |
-
with gr.Column(scale=1
|
| 365 |
input_image = gr.Image(
|
| 366 |
type='pil',
|
| 367 |
-
label="Upload Your
|
| 368 |
sources=['upload', 'webcam', 'clipboard'],
|
| 369 |
-
height=
|
|
|
|
| 370 |
)
|
| 371 |
-
analyze_button = gr.Button(
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
)
|
| 375 |
-
with gr.Column(scale=1, min_width=350):
|
| 376 |
-
gr.Markdown("### ANALYSIS RESULTS")
|
| 377 |
-
category_html = gr.HTML(label="Rating & Score")
|
| 378 |
response_box = gr.Textbox(
|
| 379 |
-
lines=
|
| 380 |
label="Verbal Feedback",
|
| 381 |
-
interactive=False
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
autoplay=True, # Keep autoplay off by default
|
| 385 |
-
label="Audio Feedback",
|
| 386 |
-
streaming=False # Keep streaming off for pre-recorded TTS
|
| 387 |
)
|
|
|
|
| 388 |
|
| 389 |
analyze_button.click(
|
| 390 |
fn=analyze_outfit,
|
|
|
|
| 343 |
return category_html, None, f"Analysis complete ({category_label}), but error generating audio/response."
|
| 344 |
|
| 345 |
# --- Elite Fashion / Techno CSS (Keep your existing CSS) ---
|
| 346 |
+
custom_css = """:root { --primary-bg-color: #000000; --secondary-bg-color: #1A1A1A; --text-color: #FFFFFF; --accent-color: #1F04FF; --border-color: #333333; --input-bg-color: #1A1A1A; --button-text-color: #FFFFFF; --body-text-size: 16px; } body,
|
| 347 |
+
.gradio-container { background-color: var(--primary-bg-color) !important; color: var(--text-color) !important; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-size: var(--body-text-size); } footer { display: none !important; }
|
| 348 |
+
.gr-block { background-color: var(--secondary-bg-color) !important; border: 1px solid var(--border-color) !important; border-radius: 8px !important; padding: 15px !important; box-shadow: none !important; } .gr-input, .gr-output, .gr-textbox textarea, .gr-dropdown select, .gr-checkboxgroup input { background-color: var(--input-bg-color) !important; color: var(--text-color) !important; border: 1px solid var(--border-color) !important; border-radius: 5px !important; }
|
| 349 |
+
.gr-textbox textarea::placeholder {
|
| 350 |
+
color: #888888 !important; }
|
| 351 |
+
.gr-label span, .gr-label .label-text {
|
| 352 |
+
color: var(--text-color) !important; font-weight: 500 !important; font-size: 0.95em !important; margin-bottom: 8px !important; }
|
| 353 |
+
.gr-image { background-color: var(--primary-bg-color) !important; border: 1px dashed var(--border-color) !important; border-radius: 8px !important; overflow: hidden; }
|
| 354 |
+
.gr-image img { border-radius: 6px !important; object-fit: contain; } .gr-image .no-image, .gr-image .upload-button { color: #AAAAAA !important; }
|
| 355 |
+
.gr-audio > div:first-of-type { border: 1px solid var(--border-color) !important; background-color: var(--secondary-bg-color) !important; border-radius: 5px !important; padding: 10px !important; }
|
| 356 |
+
.gr-audio audio { width: 100%; filter: invert(1) hue-rotate(180deg); }
|
| 357 |
+
.gr-button { border: none !important; border-radius: 5px !important; transition: background-color 0.2s ease, transform 0.1s ease; font-weight: 600 !important; }
|
| 358 |
+
.gr-button-primary { background-color: var(--accent-color) !important; color: var(--button-text-color) !important; font-size: 1.1em !important; padding: 12px 20px !important; }
|
| 359 |
+
.gr-button-primary:hover { background-color: #482FFF !important; transform: scale(1.02); box-shadow: 0 0 10px var(--accent-color); }
|
| 360 |
+
.gr-button-primary:active { transform: scale(0.98); } h1, h2, h3 { color: var(--text-color) !important; font-weight: 600; letter-spacing: 0.5px; }
|
| 361 |
+
.prose h1 { text-align: center; margin-bottom: 25px !important; font-size: 2em !important; text-transform: uppercase; letter-spacing: 1.5px; }
|
| 362 |
+
.prose p { color: #CCCCCC !important; font-size: 0.95em; text-align: center; }
|
| 363 |
+
.results-container { text-align: center; padding: 20px; border: 1px solid var(--accent-color); border-radius: 8px; background: linear-gradient(145deg, var(--secondary-bg-color), #2a2a2a); }
|
| 364 |
+
.result-category { color: var(--accent-color) !important; font-size: 1.5em; margin-bottom: 5px; font-weight: 700; text-transform: uppercase; }
|
| 365 |
+
.result-score { color: var(--text-color) !important; font-size: 1.1em; margin-top: 0; }
|
| 366 |
+
.gradio-container { max-width: 850px !important; margin: auto !important; padding-top: 30px; }
|
| 367 |
+
.gr-row { gap: 25px !important; }
|
| 368 |
.result-score {
|
| 369 |
color: var(--text-color) !important;
|
| 370 |
font-size: 1.1em;
|
|
|
|
| 372 |
margin-bottom: 5px; /* Add space below score */
|
| 373 |
}
|
| 374 |
|
| 375 |
+
.results-container {
|
| 376 |
+
backdrop-filter: blur(10px);
|
| 377 |
+
background: rgba(30, 30, 30, 0.55);
|
| 378 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 379 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
|
| 380 |
+
border-radius: 16px;
|
| 381 |
+
padding: 20px;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
.gr-button-primary:hover {
|
| 386 |
+
background-color: #5a4fff !important;
|
| 387 |
+
box-shadow: 0px 0px 15px 3px rgba(95, 70, 255, 0.6);
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
|
| 391 |
.result-error {
|
| 392 |
color: #FFAAAA !important; /* Example error color */
|
| 393 |
font-size: 0.9em;
|
|
|
|
| 395 |
}"""
|
| 396 |
|
| 397 |
# --- Gradio Interface (Using the custom CSS) ---
|
| 398 |
+
with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
| 399 |
+
gr.Markdown("<h1 style='text-align: center;'>💧 DripAI: Rate Your Fit 💧</h1>")
|
| 400 |
+
gr.Markdown("<p style='text-align: center; font-style: italic;'>AI-powered fashion judgment. Zero mercy.</p>")
|
| 401 |
+
|
| 402 |
with gr.Row():
|
| 403 |
+
with gr.Column(scale=1):
|
| 404 |
input_image = gr.Image(
|
| 405 |
type='pil',
|
| 406 |
+
label="Upload Your Fit",
|
| 407 |
sources=['upload', 'webcam', 'clipboard'],
|
| 408 |
+
height=400,
|
| 409 |
+
show_label=False
|
| 410 |
)
|
| 411 |
+
analyze_button = gr.Button("🔥 Analyze This Drip", variant="primary")
|
| 412 |
+
|
| 413 |
+
with gr.Column(scale=1):
|
| 414 |
+
category_html = gr.HTML()
|
|
|
|
|
|
|
|
|
|
| 415 |
response_box = gr.Textbox(
|
| 416 |
+
lines=2,
|
| 417 |
label="Verbal Feedback",
|
| 418 |
+
interactive=False,
|
| 419 |
+
show_label=False,
|
| 420 |
+
placeholder="Verbal feedback will show up here."
|
|
|
|
|
|
|
|
|
|
| 421 |
)
|
| 422 |
+
audio_output = gr.Audio(label="Audio Feedback", autoplay=True)
|
| 423 |
|
| 424 |
analyze_button.click(
|
| 425 |
fn=analyze_outfit,
|