Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
import gradio as gr
|
|
@@ -41,7 +44,7 @@ def process_image_interface(image) -> Tuple[str, str, str]:
|
|
| 41 |
'<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Quality Score</div></div>'
|
| 42 |
)
|
| 43 |
|
| 44 |
-
logger.info("Processing image through interface")
|
| 45 |
prompt, report, score_html = process_image_simple(image)
|
| 46 |
|
| 47 |
return prompt, report, score_html
|
|
@@ -92,7 +95,7 @@ def get_stats_info() -> str:
|
|
| 92 |
def create_interface():
|
| 93 |
"""Create the main Gradio interface"""
|
| 94 |
|
| 95 |
-
#
|
| 96 |
css = """
|
| 97 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 98 |
|
|
@@ -170,12 +173,23 @@ def create_interface():
|
|
| 170 |
font-size: 1.5rem !important;
|
| 171 |
font-weight: 500 !important;
|
| 172 |
opacity: 0.95 !important;
|
| 173 |
-
margin: 0 !important;
|
| 174 |
position: relative;
|
| 175 |
z-index: 2;
|
| 176 |
color: #ffffff !important;
|
| 177 |
}
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
.prompt-output {
|
| 180 |
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
|
| 181 |
font-size: 15px !important;
|
|
@@ -197,14 +211,15 @@ def create_interface():
|
|
| 197 |
|
| 198 |
with gr.Blocks(
|
| 199 |
theme=gr.themes.Soft(),
|
| 200 |
-
title="
|
| 201 |
css=css
|
| 202 |
) as interface:
|
| 203 |
|
| 204 |
gr.HTML("""
|
| 205 |
<div class="main-header">
|
| 206 |
-
<div class="main-title">
|
| 207 |
-
<div class="subtitle">
|
|
|
|
| 208 |
</div>
|
| 209 |
""")
|
| 210 |
|
|
@@ -219,38 +234,42 @@ def create_interface():
|
|
| 219 |
)
|
| 220 |
|
| 221 |
analyze_btn = gr.Button(
|
| 222 |
-
"🔍
|
| 223 |
variant="primary",
|
| 224 |
size="lg"
|
| 225 |
)
|
| 226 |
|
| 227 |
gr.Markdown("""
|
| 228 |
-
### How
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
-
**
|
| 231 |
|
| 232 |
-
**
|
| 233 |
|
| 234 |
-
**
|
| 235 |
|
| 236 |
**Supported formats:** JPG, PNG, WebP up to 1024px
|
| 237 |
""")
|
| 238 |
|
| 239 |
# Statistics
|
| 240 |
-
with gr.Accordion("📊 Processing
|
| 241 |
stats_output = gr.Markdown(value="No processing completed yet.")
|
| 242 |
refresh_stats_btn = gr.Button("Refresh Stats", size="sm")
|
| 243 |
|
| 244 |
with gr.Column(scale=1):
|
| 245 |
-
gr.Markdown("##
|
| 246 |
|
| 247 |
score_output = gr.HTML(
|
| 248 |
value='<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Quality Score</div></div>'
|
| 249 |
)
|
| 250 |
|
| 251 |
prompt_output = gr.Textbox(
|
| 252 |
-
label="🎯
|
| 253 |
-
placeholder="Upload an image to generate
|
| 254 |
lines=12,
|
| 255 |
max_lines=20,
|
| 256 |
show_copy_button=True
|
|
@@ -279,13 +298,18 @@ def create_interface():
|
|
| 279 |
|
| 280 |
gr.Markdown("""
|
| 281 |
---
|
| 282 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
-
|
| 285 |
-
prompts
|
| 286 |
-
configurations, lighting setups, and technical parameters for best results.
|
| 287 |
|
| 288 |
-
**
|
| 289 |
""")
|
| 290 |
|
| 291 |
return interface
|
|
@@ -293,7 +317,7 @@ def create_interface():
|
|
| 293 |
|
| 294 |
def main():
|
| 295 |
"""Main application entry point"""
|
| 296 |
-
logger.info("Starting
|
| 297 |
|
| 298 |
# Create and launch interface
|
| 299 |
demo = create_interface()
|
|
|
|
| 1 |
"""
|
| 2 |
+
Phramer AI - Main Gradio Interface
|
| 3 |
+
By Pariente AI, for MIA TV Series
|
| 4 |
+
|
| 5 |
+
Multimodal tool that reads images and turns them into refined, photo-realistic prompts.
|
| 6 |
+
Ready for Midjourney, Flux or any generative engine.
|
| 7 |
"""
|
| 8 |
|
| 9 |
import gradio as gr
|
|
|
|
| 44 |
'<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Quality Score</div></div>'
|
| 45 |
)
|
| 46 |
|
| 47 |
+
logger.info("Processing image through Phramer AI interface")
|
| 48 |
prompt, report, score_html = process_image_simple(image)
|
| 49 |
|
| 50 |
return prompt, report, score_html
|
|
|
|
| 95 |
def create_interface():
|
| 96 |
"""Create the main Gradio interface"""
|
| 97 |
|
| 98 |
+
# Updated CSS with Phramer AI branding
|
| 99 |
css = """
|
| 100 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 101 |
|
|
|
|
| 173 |
font-size: 1.5rem !important;
|
| 174 |
font-weight: 500 !important;
|
| 175 |
opacity: 0.95 !important;
|
| 176 |
+
margin: 0 0 0.5rem 0 !important;
|
| 177 |
position: relative;
|
| 178 |
z-index: 2;
|
| 179 |
color: #ffffff !important;
|
| 180 |
}
|
| 181 |
|
| 182 |
+
.tagline {
|
| 183 |
+
font-size: 1.1rem !important;
|
| 184 |
+
font-weight: 400 !important;
|
| 185 |
+
opacity: 0.85 !important;
|
| 186 |
+
margin: 0 !important;
|
| 187 |
+
position: relative;
|
| 188 |
+
z-index: 2;
|
| 189 |
+
color: #e5e7eb !important;
|
| 190 |
+
font-style: italic;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
.prompt-output {
|
| 194 |
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
|
| 195 |
font-size: 15px !important;
|
|
|
|
| 211 |
|
| 212 |
with gr.Blocks(
|
| 213 |
theme=gr.themes.Soft(),
|
| 214 |
+
title="Phramer AI",
|
| 215 |
css=css
|
| 216 |
) as interface:
|
| 217 |
|
| 218 |
gr.HTML("""
|
| 219 |
<div class="main-header">
|
| 220 |
+
<div class="main-title">Phramer AI</div>
|
| 221 |
+
<div class="subtitle">By Pariente AI, for MIA TV Series</div>
|
| 222 |
+
<div class="tagline">Multimodal tool that reads images and turns them into refined, photo-realistic prompts</div>
|
| 223 |
</div>
|
| 224 |
""")
|
| 225 |
|
|
|
|
| 234 |
)
|
| 235 |
|
| 236 |
analyze_btn = gr.Button(
|
| 237 |
+
"🔍 Generate Prompt",
|
| 238 |
variant="primary",
|
| 239 |
size="lg"
|
| 240 |
)
|
| 241 |
|
| 242 |
gr.Markdown("""
|
| 243 |
+
### How Phramer AI Works:
|
| 244 |
+
|
| 245 |
+
**1. Deep Analysis:** Custom Bagel architecture analyzes your image for semantic-visual understanding.
|
| 246 |
+
|
| 247 |
+
**2. Knowledge Enhancement:** Applies curated photographic knowledge base with camera settings and composition principles.
|
| 248 |
|
| 249 |
+
**3. Prompt Generation:** Creates structured prompts with technical details, mood, and style specifications.
|
| 250 |
|
| 251 |
+
**4. Multi-Engine Ready:** Optimized for Flux, Midjourney, and other diffusion platforms.
|
| 252 |
|
| 253 |
+
**Perfect for:** Cinematic storyboards, photorealistic scenes, visual concept exploration.
|
| 254 |
|
| 255 |
**Supported formats:** JPG, PNG, WebP up to 1024px
|
| 256 |
""")
|
| 257 |
|
| 258 |
# Statistics
|
| 259 |
+
with gr.Accordion("📊 Processing Statistics", open=False):
|
| 260 |
stats_output = gr.Markdown(value="No processing completed yet.")
|
| 261 |
refresh_stats_btn = gr.Button("Refresh Stats", size="sm")
|
| 262 |
|
| 263 |
with gr.Column(scale=1):
|
| 264 |
+
gr.Markdown("## Generated Prompt")
|
| 265 |
|
| 266 |
score_output = gr.HTML(
|
| 267 |
value='<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Quality Score</div></div>'
|
| 268 |
)
|
| 269 |
|
| 270 |
prompt_output = gr.Textbox(
|
| 271 |
+
label="🎯 Photo-Realistic Prompt",
|
| 272 |
+
placeholder="Upload an image to generate a refined prompt ready for any generative engine...",
|
| 273 |
lines=12,
|
| 274 |
max_lines=20,
|
| 275 |
show_copy_button=True
|
|
|
|
| 298 |
|
| 299 |
gr.Markdown("""
|
| 300 |
---
|
| 301 |
+
### About Phramer AI
|
| 302 |
+
|
| 303 |
+
**Phramer AI** is an advanced multimodal system developed by **Pariente AI** for the **MIA TV Series** creative pipeline.
|
| 304 |
+
|
| 305 |
+
This tool bridges the gap between image understanding and generative prompting, analyzing uploaded images through
|
| 306 |
+
a custom Bagel architecture and enhancing them with professional photographic knowledge to create detailed,
|
| 307 |
+
structured prompts ready for Flux, Midjourney, or any diffusion-based platform.
|
| 308 |
|
| 309 |
+
Whether creating cinematic storyboards, photorealistic scenes, or exploring visual concepts, Phramer AI delivers
|
| 310 |
+
refined prompts with camera settings, composition hints, mood specifications, and style guidance.
|
|
|
|
| 311 |
|
| 312 |
+
**Pariente AI** • Advanced Multimodal AI Research & Development • **MIA TV Series**
|
| 313 |
""")
|
| 314 |
|
| 315 |
return interface
|
|
|
|
| 317 |
|
| 318 |
def main():
|
| 319 |
"""Main application entry point"""
|
| 320 |
+
logger.info("Starting Phramer AI by Pariente AI")
|
| 321 |
|
| 322 |
# Create and launch interface
|
| 323 |
demo = create_interface()
|