akhaliq HF Staff commited on
Commit
919d507
Β·
1 Parent(s): a2cdcfb
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -89,9 +89,14 @@ def filter_problematic_instructions(content: str) -> str:
89
  r"Output ONLY the code inside a ``` code block, and do not include any explanations or extra text",
90
  r"output only the code inside a ```.*?``` code block",
91
  r"Always output only the.*?code.*?inside.*?```.*?```.*?block",
 
92
  r"Do NOT add the language name at the top of the code output",
93
  r"do not include any explanations or extra text",
94
  r"Always output only the.*?code blocks.*?shown above, and do not include any explanations",
 
 
 
 
95
  ]
96
 
97
  # Remove problematic patterns
@@ -216,7 +221,7 @@ def update_gradio_system_prompts():
216
  docs_content = get_gradio_docs_content()
217
 
218
  # Base system prompt
219
- 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. Generate complete, working code that can be run immediately. If the user provides a file or other context, use it as a reference. Make the app as self-contained as possible.
220
 
221
  🚨 IMPORTANT: If the user is asking to use external APIs (like OpenRouter, OpenAI API, Hugging Face Inference API, etc.), DO NOT use @spaces.GPU decorators or any ZeroGPU features. External APIs handle the model inference remotely, so GPU allocation on the Spaces instance is not needed.
222
 
@@ -485,7 +490,7 @@ This reference is automatically synced from https://www.gradio.app/llms.txt to e
485
  """
486
 
487
  # Search-enabled prompt
488
- 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. Generate complete, working code that can be run immediately. If the user provides a file or other context, use it as a reference. Make the app as self-contained as possible.
489
 
490
  🚨 IMPORTANT: If the user is asking to use external APIs (like OpenRouter, OpenAI API, Hugging Face Inference API, etc.), DO NOT use @spaces.GPU decorators or any ZeroGPU features. External APIs handle the model inference remotely, so GPU allocation on the Spaces instance is not needed.
491
 
@@ -904,7 +909,7 @@ Structural requirements:
904
  - Include required <link> tags for any CSS you reference (e.g., Tailwind, Font Awesome, Google Fonts)
905
  - Keep everything in ONE file; inline CSS/JS as needed
906
 
907
- Return ONLY the code inside a single ```html ... ``` code block. No additional text before or after.
908
 
909
  IMPORTANT: Always include "Built with anycoder" as clickable text in the header/top section of your application that links to https://huggingface.co/spaces/akhaliq/anycoder
910
  """
 
89
  r"Output ONLY the code inside a ``` code block, and do not include any explanations or extra text",
90
  r"output only the code inside a ```.*?``` code block",
91
  r"Always output only the.*?code.*?inside.*?```.*?```.*?block",
92
+ r"Return ONLY the code inside a.*?```.*?``` code block",
93
  r"Do NOT add the language name at the top of the code output",
94
  r"do not include any explanations or extra text",
95
  r"Always output only the.*?code blocks.*?shown above, and do not include any explanations",
96
+ r"Output.*?ONLY.*?code.*?inside.*?```.*?```",
97
+ r"Return.*?ONLY.*?code.*?inside.*?```.*?```",
98
+ r"Generate.*?ONLY.*?code.*?inside.*?```.*?```",
99
+ r"Provide.*?ONLY.*?code.*?inside.*?```.*?```",
100
  ]
101
 
102
  # Remove problematic patterns
 
221
  docs_content = get_gradio_docs_content()
222
 
223
  # Base system prompt
224
+ base_prompt = """You are an expert Gradio developer. Create a complete, working Gradio application based on the user's request. Generate all necessary code to make the application functional and runnable.
225
 
226
  🚨 IMPORTANT: If the user is asking to use external APIs (like OpenRouter, OpenAI API, Hugging Face Inference API, etc.), DO NOT use @spaces.GPU decorators or any ZeroGPU features. External APIs handle the model inference remotely, so GPU allocation on the Spaces instance is not needed.
227
 
 
490
  """
491
 
492
  # Search-enabled prompt
493
+ search_prompt = """You are an expert Gradio developer with access to real-time web search. Create a complete, working Gradio application based on the user's request. When needed, use web search to find current best practices or verify latest Gradio features. Generate all necessary code to make the application functional and runnable.
494
 
495
  🚨 IMPORTANT: If the user is asking to use external APIs (like OpenRouter, OpenAI API, Hugging Face Inference API, etc.), DO NOT use @spaces.GPU decorators or any ZeroGPU features. External APIs handle the model inference remotely, so GPU allocation on the Spaces instance is not needed.
496
 
 
909
  - Include required <link> tags for any CSS you reference (e.g., Tailwind, Font Awesome, Google Fonts)
910
  - Keep everything in ONE file; inline CSS/JS as needed
911
 
912
+ Generate complete, working HTML code that can be run immediately.
913
 
914
  IMPORTANT: Always include "Built with anycoder" as clickable text in the header/top section of your application that links to https://huggingface.co/spaces/akhaliq/anycoder
915
  """