ComfyGen Studio is a sleek and intuitive mobile interface for ComfyUI, designed to simplify your image generation workflow on the go. This project enhances the original ComfyUI with a user-friendly interface and additional features.
This fork of ComfyGen Studio was created to bypass the limitations of ComfyUI's node-based interface on mobile devices, providing a streamlined, touch-friendly way to use the Flux image generation model directly from iPhones and iPads without dealing with complex node arrangements.
- Project Screenshots
- Setting Up ComfyGen Studio
- New Features and Enhancements
- Using the Default Flux Workflow
- Troubleshooting
- Contributing
- License
- Acknowledgments
- ComfyUI installed
- A compatible GPU (for optimal performance)
- Basic familiarity with ComfyUI workflows
To set up ComfyGen Studio using ComfyUI, follow these steps:
- Clone or download this repository directly into the
ComfyUI/custom_nodes/directory. - Execute
run_nvidia_gpu.batorrun_cpu.bat(or your usual ComfyUI startup script) to start the ComfyUI server. - (Optional but Recommended for Flux) Ensure you have the necessary Flux models and nodes installed as described in the Using the Default Flux Workflow section.
- (Optional) Replace the default workflow:
- Enable Dev Mode Options: In the standard ComfyUI interface, click "Settings" (gear icon) and enable "Dev mode options".
- Generate Workflow JSON: Load your desired workflow in ComfyUI, then click "Save (API Format)". This saves a
.jsonfile representing your workflow structure. - Replace Base Workflow: Replace the content of
ComfyUI/custom_nodes/comfygen/web/js/base_workflow.jsonwith the content of the JSON file you just saved. - Important: Update JavaScript code if you replaced the workflow (see Troubleshooting).
- Access ComfyGen Studio: Open your web browser and navigate to
http://<your_comfyui_address>:<port>/comfygen(e.g.,http://127.0.0.1:8188/comfygen).
ComfyGen Studio introduces several improvements:
- Responsive Design: Optimized for mobile with a clean layout.
- Image Size Control: Presets and custom inputs.
- Generation Settings: Control steps, seed, and LoRA usage.
- Image History: Navigate through generated images.
- Prompt Management: Recent and favorite prompts lists.
- Real-time Updates: WebSocket integration for live progress.
The default base_workflow.json is optimized for Flux.1-dev.
- Performance: On an RTX 3070 8GB VRAM, 64GB RAM, expect ~45-50 seconds per 576x1024 prompt at 8 steps with the default LoRA.
Required Setup for Default Workflow:
- Flux.1-dev Model: Download
flux1-dev-fp8.safetensors(fp8 recommended for performance/VRAM) from Kijai/flux-fp8. Place it inComfyUI/models/checkpoints/. - VAE: Download the VAE from black-forest-labs/FLUX.1-schnell. Rename
diffusion_pytorch_model.safetensorsto something clear likeflux-schnell-vae.safetensorsand place it inComfyUI/models/vae/. (Note: The default workflow doesn't explicitly load this VAE, it uses the one baked into the checkpoint. You might need to modify the workflow API JSON if you want to force a specific VAE.) - Text Encoders: Download
clip_l.safetensorsandt5xxl_fp8_wrap.safetensorsfrom comfyanonymous/flux_text_encoders. Place them inComfyUI/models/clip/. - LoRA (Optional but Defaulted ON): Download
Hyper-FLUX.1-dev-8steps-lora.safetensorsfrom Kijai/flux-fp8 (or another compatible LoRA). Place it inComfyUI/models/loras/. The UI defaults to using this LoRA; uncheck "Use LoRA" if you don't have it or don't want to use it. - Custom Nodes: Ensure you have the necessary custom nodes installed and updated. Use the ComfyUI Manager or install manually:
- FluxNodes by
comfyanonymous(providesFluxGuidance,EmptySD3LatentImage) - Potentially others depending on variations. The default workflow seems standard.
- FluxNodes by
- Restart ComfyUI after placing models and installing nodes.
- Performance Note: Avoid
--lowvramif possible, as it can significantly slow down Flux. The fp8 model is designed for better performance on lower VRAM cards.
If you replaced web/js/base_workflow.json with your own workflow's API format JSON, you must update the JavaScript code in web/js/app.js to target the correct node IDs in your workflow for setting the prompt, seed, dimensions, steps, and model connections (especially for LoRA).
-
Open
web/js/app.js. -
Locate the
WORKFLOW_NODE_IDSconstant near the top of the file. -
Modify the string values (e.g.,
'6','31') to match the corresponding node IDs from your saved API format JSON file. Find the nodes in your JSON that perform these functions:POSITIVE_PROMPT: TheCLIPTextEncodenode where your main positive prompt goes.NEGATIVE_PROMPT: (Optional) TheCLIPTextEncodenode for the negative prompt if you need to modify it.CHECKPOINT_LOADER: TheCheckpointLoaderSimple(or similar) node loading your main model.LORA_LOADER: TheLoraLoadernode if you intend to use the LoRA checkbox.EMPTY_LATENT: The node creating the initial latent image (e.g.,EmptySD3LatentImage,EmptyLatentImage).KSAMPLER: The mainKSamplerorKSamplerAdvancednode.SAVE_IMAGE: TheSaveImagenode (needed to detect when the final image is ready).
-
Locate the section within the
queuePromptWithTextfunction that modifiesfreshWorkflow. Ensure the logic correctly uses your updatedWORKFLOW_NODE_IDS. Pay special attention to the LoRA handling section, making sure it connects theKSAMPLER'smodelinput correctly (either to theLORA_LOADERoutput or theCHECKPOINT_LOADERoutput).Example snippet from
queuePromptWithTextshowing where IDs are used:// Note: These constants must match your updated WORKFLOW_NODE_IDS at the top. // Example uses IDs from the default Flux workflow provided. // Positive Prompt if (freshWorkflow[WORKFLOW_NODE_IDS.POSITIVE_PROMPT]?.inputs) { freshWorkflow[WORKFLOW_NODE_IDS.POSITIVE_PROMPT]['inputs']['text'] = text.replace(/(\r\n|\n|\r)/gm, ' '); } // Seed (KSampler) if (freshWorkflow[WORKFLOW_NODE_IDS.KSAMPLER]?.inputs) { freshWorkflow[WORKFLOW_NODE_IDS.KSAMPLER]['inputs']['seed'] = seedForThisRun; } // Dimensions (EmptyLatentImage) const dimensions = PromptControlUI.getWorkflowDimensions(); if (freshWorkflow[WORKFLOW_NODE_IDS.EMPTY_LATENT]?.inputs) { freshWorkflow[WORKFLOW_NODE_IDS.EMPTY_LATENT]['inputs']['width'] = dimensions.width; freshWorkflow[WORKFLOW_NODE_IDS.EMPTY_LATENT]['inputs']['height'] = dimensions.height; } // Steps (KSampler) const steps = PromptControlUI.getWorkflowSteps(); if (freshWorkflow[WORKFLOW_NODE_IDS.KSAMPLER]?.inputs) { freshWorkflow[WORKFLOW_NODE_IDS.KSAMPLER]['inputs']['steps'] = steps; } // Handle LoRA connection const loraCheckbox = getEnableLoraCheckboxElement(); const enableLora = loraCheckbox ? loraCheckbox.checked : false; const kSamplerNode = freshWorkflow[WORKFLOW_NODE_IDS.KSAMPLER]; if (kSamplerNode?.inputs) { if (enableLora && freshWorkflow[WORKFLOW_NODE_IDS.LORA_LOADER]) { // Connect KSampler to LoRA Loader kSamplerNode['inputs']['model'] = [WORKFLOW_NODE_IDS.LORA_LOADER, 0]; // Ensure LoRA Loader gets model from Checkpoint Loader if(freshWorkflow[WORKFLOW_NODE_IDS.LORA_LOADER].inputs){ freshWorkflow[WORKFLOW_NODE_IDS.LORA_LOADER]['inputs']['model'] = [WORKFLOW_NODE_IDS.CHECKPOINT_LOADER, 0]; } } else { // Connect KSampler directly to Checkpoint Loader kSamplerNode['inputs']['model'] = [WORKFLOW_NODE_IDS.CHECKPOINT_LOADER, 0]; // Remove LoRA node if disabling LoRA if (!enableLora && freshWorkflow[WORKFLOW_NODE_IDS.LORA_LOADER]) { delete freshWorkflow[WORKFLOW_NODE_IDS.LORA_LOADER]; } } }
-
Clear your browser cache and refresh the ComfyGen Studio page (
/comfygen).
If you encounter issues:
- Check Browser Console: Open your browser's developer tools (usually F12) and look for errors in the Console tab. This often pinpoints JavaScript issues.
- Check ComfyUI Console: Look at the terminal window where you started ComfyUI for backend errors (e.g., missing models, node errors).
- Verify Node IDs: Double-check that the IDs in
web/js/app.jsperfectly match the IDs in yourweb/js/base_workflow.json. - Consult ComfyUI Docs: Refer to the official ComfyUI documentation for general workflow or node-specific questions.
Contributions are welcome! Fork the repository and submit a pull request with your improvements.
This project is licensed under the MIT License.
- Original ComfyUI project by
comfyanonymous. - Flux model and node developers.
- Contributors and users of ComfyGen Studio.
This fork is maintained primarily for personal use. Updates may be infrequent.
