Spaces:
raheem786
/
Paused

akhaliq HF Staff commited on
Commit
613b744
Β·
1 Parent(s): 75503d6

Create standalone backend_prompts.py without Gradio dependencies

Browse files

Issue: Backend depends on anycoder_app which has Gradio dependencies
Solution: Extract all system prompts to standalone backend_prompts.py

New file: backend_prompts.py
- No dependencies on Gradio, config, or other heavy libraries
- Pure Python with just string prompts
- Includes all 7 language/framework prompts:
* HTML_SYSTEM_PROMPT
* TRANSFORMERS_JS_SYSTEM_PROMPT
* STREAMLIT_SYSTEM_PROMPT
* REACT_SYSTEM_PROMPT
* GRADIO_SYSTEM_PROMPT (static version)
* JSON_SYSTEM_PROMPT (static version)
* GENERIC_SYSTEM_PROMPT

Benefits:
βœ… Backend starts faster (no Gradio imports)
βœ… No dependency on anycoder_app directory
βœ… Cleaner separation of concerns
βœ… Same expert-level prompts for all languages
βœ… Easier to maintain and update prompts
βœ… No circular dependencies
βœ… Works in Docker without full Gradio installation

Updated backend_api.py:
- Import from backend_prompts instead of anycoder_app.prompts
- Simpler, cleaner import with single try/except
- Fallback prompts if import fails
- Clear startup logging

This makes the backend fully independent and portable!

2 files changed +270 -27
Files changed (2)
backend_api.py+10-27
backend_prompts.pyAdded+260