"""
Phramer AI - Main Gradio Interface
By Pariente AI, for MIA TV Series
Multimodal tool that reads images and turns them into refined, photo-realistic prompts.
Ready for Midjourney, Flux or any generative engine.
"""
import gradio as gr
import logging
import warnings
import os
from typing import Tuple
from config import APP_CONFIG, ENVIRONMENT
from processor import process_image_simple, phramer_optimizer
from utils import setup_logging, clean_memory
# Configure environment
warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings("ignore", category=UserWarning)
os.environ["TOKENIZERS_PARALLELISM"] = "false"
# Setup logging
setup_logging(ENVIRONMENT["log_level"])
logger = logging.getLogger(__name__)
def process_image_interface(image) -> Tuple[str, str, str]:
"""
Main interface function for image processing
Args:
image: Input image from Gradio interface
Returns:
Tuple of (prompt, analysis_report, score_html)
"""
try:
if image is None:
return (
"Please upload an image to analyze",
"No image provided for analysis.",
'
Phramer AI
By Pariente AI, for MIA TV Series
Multimodal tool that reads images and turns them into refined, photo-realistic prompts
""")
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("## Image Analysis")
image_input = gr.Image(
label="Upload image for analysis",
type="pil",
height=500
)
analyze_btn = gr.Button(
"🔍 Generate Prompt",
variant="primary",
size="lg"
)
gr.Markdown("""
### How Phramer AI Works:
**1. Deep Analysis:** Custom Bagel architecture analyzes your image for semantic-visual understanding.
**2. Knowledge Enhancement:** Applies curated photographic knowledge base with camera settings and composition principles.
**3. Prompt Generation:** Creates structured prompts with technical details, mood, and style specifications.
**4. Multi-Engine Ready:** Optimized for Flux, Midjourney, and other diffusion platforms.
**Perfect for:** Cinematic storyboards, photorealistic scenes, visual concept exploration.
**Supported formats:** JPG, PNG, WebP up to 1024px
""")
# Statistics
with gr.Accordion("📊 Processing Statistics", open=False):
stats_output = gr.Markdown(value="No processing completed yet.")
refresh_stats_btn = gr.Button("Refresh Stats", size="sm")
with gr.Column(scale=1):
gr.Markdown("## Generated Prompt")
score_output = gr.HTML(
value='