use daggr latest version
Browse filesFiles changed (4)
22 unmodified lines232425262627282930793 unmodified lines82482582682782882983083117 unmodified lines8498508518498528538548559 unmodified lines86586686786886987087187259 unmodified lines932933934935936937938939599 unmodified lines1539154015411542154315441545154649 unmodified lines1596159715981599160016011602160316041594160516061607160822 unmodified lines strip_tool_call_markers, remove_code_block, extract_import_statements, generate_requirements_txt_with_llm generate_requirements_txt_with_llm, enforce_critical_versions)
793 unmodified lines file_path = temp_path / filename print(f"[Deploy] Writing {filename} ({len(content)} chars) to {file_path}") # Use text mode - Python handles encoding automatically if filename == "requirements.txt": content = enforce_critical_versions(content) file_path.write_text(content, encoding='utf-8') # Verify the write was successful written_size = file_path.stat().st_size17 unmodified lines html_code = prettify_comfyui_json_for_html(code) (temp_path / "index.html").write_text(html_code, encoding='utf-8') elif language in ["gradio", "streamlit"]: elif language in ["gradio", "streamlit", "daggr"]: files = parse_multi_file_python_output(code) # Fallback: if no files parsed (missing === markers), treat entire code as app.py9 unmodified lines for filename, content in files.items(): file_path = temp_path / filename file_path.parent.mkdir(parents=True, exist_ok=True) if filename == "requirements.txt": content = enforce_critical_versions(content) file_path.write_text(content, encoding='utf-8') # Ensure requirements.txt exists - generate from imports if missing59 unmodified lines for filename, content in files.items(): file_path = temp_path / filename file_path.parent.mkdir(parents=True, exist_ok=True) if filename == "requirements.txt": content = enforce_critical_versions(content) file_path.write_text(content, encoding='utf-8') # Generate requirements.txt from imports if missing599 unmodified lines # Write transformers.js files for filename, content in files.items(): file_path = temp_path / filename if filename == "requirements.txt": content = enforce_critical_versions(content) file_path.write_text(content, encoding='utf-8') except Exception as e:49 unmodified lines for filename, content in files.items(): file_path = temp_path / filename file_path.parent.mkdir(parents=True, exist_ok=True) if filename == "requirements.txt": content = enforce_critical_versions(content) file_path.write_text(content, encoding='utf-8') # Skip requirements.txt generation for Gradio PRs (preserve existing) # For Streamlit, generate requirements.txt if missing if language == "streamlit" and "requirements.txt" not in files: if language in ["streamlit", "daggr"] and "requirements.txt" not in files: main_app = files.get('streamlit_app.py') or files.get('app.py', '') if main_app: print(f"[PR] Generating requirements.txt from imports")443 unmodified lines444445446447447448449450443 unmodified lines
**File Organization:**- `app.py` - Main application entry point (REQUIRED)- `requirements.txt` - Python dependencies (REQUIRED, auto-generated from imports)- `requirements.txt` - Python dependencies (REQUIRED, auto-generated from imports). ALWAYS use `daggr>=0.5.4` and `gradio>=6.0.2` if applicable.- `utils.py` - Utility functions and helpers (optional)- `models.py` - Model loading and inference functions (optional)- `config.py` - Configuration and constants (optional)191 unmodified lines1921931941951961951961971981994 unmodified lines204205206207208209210211154 unmodified lines36636736836937037137237337437537637737837938038138238338438538638797 unmodified lines4854864874884894904914928 unmodified lines501502503484504505506507508509191 unmodified lines """Parse multi-file Python output (e.g., Gradio, Streamlit)""" files = {} # Pattern to match file sections pattern = r'===\s*(\S+\.(?:py|txt))\s*===\s*(.*?)(?====|$)' # Pattern to match file sections like === filename.ext === pattern = r'===\s*(\S+\.\w+)\s*===\s*(.*?)(?=\n\s*===\s*\S+\.\w+\s*===|$)' matches = re.finditer(pattern, code, re.DOTALL | re.IGNORECASE) for match in matches:4 unmodified lines content = re.sub(r'^```\w*\s*', '', content, flags=re.MULTILINE) content = re.sub(r'```\s*$', '', content, flags=re.MULTILINE) if filename == "requirements.txt": content = enforce_critical_versions(content) files[filename] = content return files154 unmodified lines return files if isinstance(files, dict) and files else {}
def enforce_critical_versions(requirements_content: str) -> str: """Ensure critical packages like daggr and gradio have minimum required versions""" if 'daggr' in requirements_content: # Check if version is already specified if 'daggr>=' not in requirements_content and 'daggr==' not in requirements_content: # Replace plain 'daggr' with pinned version, preserving comments requirements_content = re.sub(r'^daggr\s*(?=[#\n]|$)', 'daggr>=0.5.4', requirements_content, flags=re.MULTILINE) if 'gradio' in requirements_content: if 'gradio>=' not in requirements_content and 'gradio==' not in requirements_content: # Replace plain 'gradio' with pinned version, preserving comments requirements_content = re.sub(r'^gradio\s*(?=[#\n]|$)', 'gradio>=6.0.2', requirements_content, flags=re.MULTILINE) return requirements_content
def generate_requirements_txt_with_llm(import_statements): """Generate requirements.txt content using LLM based on import statements.""" if not import_statements:97 unmodified lines requirements_content = '\n'.join(clean_lines).strip() requirements_content = enforce_critical_versions(requirements_content) # Ensure it ends with a newline if requirements_content and not requirements_content.endswith('\n'): requirements_content += '\n'8 unmodified lines 'PIL': 'Pillow', 'sklearn': 'scikit-learn', 'skimage': 'scikit-image', 'bs4': 'beautifulsoup4' 'bs4': 'beautifulsoup4', 'daggr': 'daggr>=0.5.4', 'gradio': 'gradio>=6.0.2' } for stmt in import_statements:161 unmodified lines162163164165165166167168453 unmodified lines622623624625626627628629630631161 unmodified lines[main application code]
=== requirements.txt ===[dependencies][dependencies]. ALWAYS use `daggr>=0.5.4` and `gradio>=6.0.2` if applicable.
=== utils.py ===[utility functions - optional]453 unmodified linesgraph = Graph(name="My Workflow", nodes=[node1, node2])graph.launch()
=== requirements.txt ===daggr>=0.5.4gradio>=6.0.2
**🚨 CRITICAL: DO NOT Generate README.md Files**- NEVER generate README.md files under any circumstances- A template README.md is automatically provided and will be overridden by the deployment systembackend_deploy.py+14-3
backend_docs_manager.py+1-1
backend_parsers.py+25-3
backend_prompts.py+5-1