akhaliq HF Staff commited on
Commit
c7296da
·
1 Parent(s): 77b8b6c

update system prompt

Browse files
Files changed (1) hide show
  1. app.py +38 -6
app.py CHANGED
@@ -185,7 +185,9 @@ def update_gradio_system_prompts():
185
  # Base system prompt
186
  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.
187
 
188
- ## ZeroGPU Integration (REQUIRED)
 
 
189
 
190
  ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
191
 
@@ -232,11 +234,23 @@ Functions that typically need @spaces.GPU:
232
  - Model inference with transformers, diffusers
233
  - Any function using .to('cuda') or GPU operations
234
 
235
- ## Advanced ZeroGPU Optimization (Recommended)
236
 
237
- For production Spaces with heavy models, use ahead-of-time (AoT) compilation for 1.3x-1.8x speedups:
 
238
 
239
- ### Basic AoT Compilation
 
 
 
 
 
 
 
 
 
 
 
240
  ```python
241
  import spaces
242
  import torch
@@ -438,7 +452,9 @@ This reference is automatically synced from https://www.gradio.app/llms.txt to e
438
  # Search-enabled prompt
439
  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.
440
 
441
- ## ZeroGPU Integration (REQUIRED)
 
 
442
 
443
  ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
444
 
@@ -485,7 +501,23 @@ Functions that typically need @spaces.GPU:
485
  - Model inference with transformers, diffusers
486
  - Any function using .to('cuda') or GPU operations
487
 
488
- ## Advanced ZeroGPU Optimization (Recommended)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
 
490
  For production Spaces with heavy models, use ahead-of-time (AoT) compilation for 1.3x-1.8x speedups:
491
 
 
185
  # Base system prompt
186
  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.
187
 
188
+ 🚨 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.
189
+
190
+ ## ZeroGPU Integration (MANDATORY)
191
 
192
  ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
193
 
 
234
  - Model inference with transformers, diffusers
235
  - Any function using .to('cuda') or GPU operations
236
 
237
+ ## CRITICAL: Use ZeroGPU AoT Compilation for ALL Diffusion Models
238
 
239
+ FOR ANY DIFFUSION MODEL (FLUX, Stable Diffusion, etc.), YOU MUST IMPLEMENT AHEAD-OF-TIME COMPILATION.
240
+ This is NOT optional - it provides 1.3x-1.8x speedup and is essential for production ZeroGPU Spaces.
241
 
242
+ ALWAYS implement this pattern for diffusion models:
243
+
244
+ ### MANDATORY: Basic AoT Compilation Pattern
245
+ YOU MUST USE THIS EXACT PATTERN for any diffusion model (FLUX, Stable Diffusion, etc.):
246
+
247
+ 1. ALWAYS add AoT compilation function with @spaces.GPU(duration=1500)
248
+ 2. ALWAYS use spaces.aoti_capture to capture inputs
249
+ 3. ALWAYS use torch.export.export to export the transformer
250
+ 4. ALWAYS use spaces.aoti_compile to compile
251
+ 5. ALWAYS use spaces.aoti_apply to apply to pipeline
252
+
253
+ ### Required AoT Implementation
254
  ```python
255
  import spaces
256
  import torch
 
452
  # Search-enabled prompt
453
  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.
454
 
455
+ 🚨 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.
456
+
457
+ ## ZeroGPU Integration (MANDATORY)
458
 
459
  ALWAYS use ZeroGPU for GPU-dependent functions in Gradio apps:
460
 
 
501
  - Model inference with transformers, diffusers
502
  - Any function using .to('cuda') or GPU operations
503
 
504
+ ## CRITICAL: Use ZeroGPU AoT Compilation for ALL Diffusion Models
505
+
506
+ FOR ANY DIFFUSION MODEL (FLUX, Stable Diffusion, etc.), YOU MUST IMPLEMENT AHEAD-OF-TIME COMPILATION.
507
+ This is NOT optional - it provides 1.3x-1.8x speedup and is essential for production ZeroGPU Spaces.
508
+
509
+ ALWAYS implement this pattern for diffusion models:
510
+
511
+ ### MANDATORY: Basic AoT Compilation Pattern
512
+ YOU MUST USE THIS EXACT PATTERN for any diffusion model (FLUX, Stable Diffusion, etc.):
513
+
514
+ 1. ALWAYS add AoT compilation function with @spaces.GPU(duration=1500)
515
+ 2. ALWAYS use spaces.aoti_capture to capture inputs
516
+ 3. ALWAYS use torch.export.export to export the transformer
517
+ 4. ALWAYS use spaces.aoti_compile to compile
518
+ 5. ALWAYS use spaces.aoti_apply to apply to pipeline
519
+
520
+ ### Required AoT Implementation
521
 
522
  For production Spaces with heavy models, use ahead-of-time (AoT) compilation for 1.3x-1.8x speedups:
523