update system prompt
Browse files184 unmodified lines18518618718818918819019119219340 unmodified lines234235236235237238237239240241239242243244245246247248249250251252253254255256195 unmodified lines45245345445545644145745845946040 unmodified lines501502503488504505506507508509510511512513514515516517518519520521522523184 unmodified lines # Base system prompt base_prompt = """You are an expert Gradio developer. Write clean, idiomatic, and runnable Gradio applications for the user's request. Use the latest Gradio API and best practices. Output ONLY the code inside a ``` code block, and do not include any explanations or extra text. If the user provides a file or other context, use it as a reference. Make the app as self-contained as possible. Do NOT add the language name at the top of the code output.
🚨 CRITICAL REQUIREMENT: If the user provides ANY diffusion model code (FLUX, Stable Diffusion, etc.), you MUST implement ZeroGPU ahead-of-time (AoT) compilation. This is mandatory and provides 1.3x-1.8x performance improvements. Do not create basic Gradio apps without AoT optimization for diffusion models.
## ZeroGPU Integration (REQUIRED)## ZeroGPU Integration (MANDATORY)
ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
40 unmodified lines- Model inference with transformers, diffusers- Any function using .to('cuda') or GPU operations
## Advanced ZeroGPU Optimization (Recommended)## CRITICAL: Use ZeroGPU AoT Compilation for ALL Diffusion Models
For production Spaces with heavy models, use ahead-of-time (AoT) compilation for 1.3x-1.8x speedups:FOR ANY DIFFUSION MODEL (FLUX, Stable Diffusion, etc.), YOU MUST IMPLEMENT AHEAD-OF-TIME COMPILATION.This is NOT optional - it provides 1.3x-1.8x speedup and is essential for production ZeroGPU Spaces.
### Basic AoT CompilationALWAYS implement this pattern for diffusion models:
### MANDATORY: Basic AoT Compilation PatternYOU MUST USE THIS EXACT PATTERN for any diffusion model (FLUX, Stable Diffusion, etc.):
1. ALWAYS add AoT compilation function with @spaces.GPU(duration=1500)2. ALWAYS use spaces.aoti_capture to capture inputs3. ALWAYS use torch.export.export to export the transformer4. ALWAYS use spaces.aoti_compile to compile5. ALWAYS use spaces.aoti_apply to apply to pipeline
### Required AoT Implementation```pythonimport spacesimport torch195 unmodified lines # Search-enabled prompt search_prompt = """You are an expert Gradio developer with access to real-time web search. Write clean, idiomatic, and runnable Gradio applications for the user's request. Use the latest Gradio API and best practices. When needed, use web search to find current best practices or verify latest Gradio features. Output ONLY the code inside a ``` code block, and do not include any explanations or extra text. If the user provides a file or other context, use it as a reference. Make the app as self-contained as possible. Do NOT add the language name at the top of the code output.
🚨 CRITICAL REQUIREMENT: If the user provides ANY diffusion model code (FLUX, Stable Diffusion, etc.), you MUST implement ZeroGPU ahead-of-time (AoT) compilation. This is mandatory and provides 1.3x-1.8x performance improvements. Do not create basic Gradio apps without AoT optimization for diffusion models.
## ZeroGPU Integration (REQUIRED)## ZeroGPU Integration (MANDATORY)
ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
40 unmodified lines- Model inference with transformers, diffusers- Any function using .to('cuda') or GPU operations
## Advanced ZeroGPU Optimization (Recommended)## CRITICAL: Use ZeroGPU AoT Compilation for ALL Diffusion Models
FOR ANY DIFFUSION MODEL (FLUX, Stable Diffusion, etc.), YOU MUST IMPLEMENT AHEAD-OF-TIME COMPILATION.This is NOT optional - it provides 1.3x-1.8x speedup and is essential for production ZeroGPU Spaces.
ALWAYS implement this pattern for diffusion models:
### MANDATORY: Basic AoT Compilation PatternYOU MUST USE THIS EXACT PATTERN for any diffusion model (FLUX, Stable Diffusion, etc.):
1. ALWAYS add AoT compilation function with @spaces.GPU(duration=1500)2. ALWAYS use spaces.aoti_capture to capture inputs3. ALWAYS use torch.export.export to export the transformer4. ALWAYS use spaces.aoti_compile to compile5. ALWAYS use spaces.aoti_apply to apply to pipeline
### Required AoT Implementation
For production Spaces with heavy models, use ahead-of-time (AoT) compilation for 1.3x-1.8x speedups:
app.py+38-6