Skip to Content
DocumentaciónIAImagen y voz de IA

Imagen y voz con IA

La tecnología de IA puede hacer mucho más que procesar texto: también puede generar imágenes de alta calidad y procesar voz. Este artículo explica cómo instalar y usar las principales herramientas de generación de imágenes y reconocimiento de voz con IA en Ubuntu 26.04.

Stable Diffusion WebUI (AUTOMATIC1111)

La Stable Diffusion WebUI de AUTOMATIC1111 es la herramienta de generación de imágenes con IA más popular. Ofrece una interfaz web repleta de funciones que admite texto a imagen (txt2img), imagen a imagen (img2img), inpainting y mucho más.

Requisitos del sistema

  • Se recomienda una GPU NVIDIA con 8 GB o más de VRAM
  • Python 3.10+
  • Al menos 15 GB de espacio en disco (los modelos base ocupan de 4 a 7 GB cada uno)

Instalar las dependencias

# Install system dependencies sudo apt update sudo apt install -y git python3 python3-venv python3-pip \ libgl1 libglib2.0-0t64 libsm6 libxext6 libxrender1 \ wget curl # Ensure NVIDIA drivers and CUDA are installed (see GPU Setup section) nvidia-smi

Instalar Stable Diffusion WebUI

# Clone the repository cd ~ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git cd stable-diffusion-webui # First launch (automatically installs Python dependencies and downloads base models) # This may take 10-30 minutes depending on network speed ./webui.sh
# Custom launch parameters ./webui.sh --listen --port 7860 --enable-insecure-extension-access # Common launch parameters: # --listen Allow remote access (default is local only) # --port 7860 Specify port # --xformers Enable xformers acceleration (recommended) # --medvram Medium VRAM optimization (recommended for 8GB GPUs) # --lowvram Low VRAM optimization (for 4-6GB GPUs) # --no-half Disable half precision (needed for some AMD GPUs)

Descargar modelos

El núcleo de Stable Diffusion es el archivo de modelo checkpoint, que debe descargarse manualmente y colocarse en el directorio indicado.

# Model storage directory mkdir -p ~/stable-diffusion-webui/models/Stable-diffusion # Download Stable Diffusion XL base model wget -O ~/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0.safetensors \ "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors" # Download SDXL Refiner (optional, for image refinement) wget -O ~/stable-diffusion-webui/models/Stable-diffusion/sd_xl_refiner_1.0.safetensors \ "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors"
# Download VAE model (improves image colors) mkdir -p ~/stable-diffusion-webui/models/VAE wget -O ~/stable-diffusion-webui/models/VAE/sdxl_vae.safetensors \ "https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"

Descargar modelos populares de la comunidad

La comunidad publica muchos modelos ajustados en Civitai y Hugging Face:

# Place models in the corresponding directories # Checkpoint models -> models/Stable-diffusion/ # LoRA models -> models/Lora/ # VAE models -> models/VAE/ # Embeddings -> embeddings/ mkdir -p ~/stable-diffusion-webui/models/Lora mkdir -p ~/stable-diffusion-webui/embeddings # Example: download a model from Hugging Face # wget -O ~/stable-diffusion-webui/models/Stable-diffusion/model_name.safetensors "download-link"

Usar la interfaz web

Una vez iniciada, visita http://localhost:7860 en tu navegador:

  1. txt2img — Escribe un prompt para generar imágenes
  2. img2img — Sube una imagen de referencia y modifícala siguiendo un prompt
  3. Inpaint — Selecciona una zona de una imagen para redibujarla localmente
  4. Extensions — Instala complementos para ampliar la funcionalidad

Prompts de ejemplo:

Positive prompt: a beautiful mountain landscape, sunset, golden hour, photorealistic, 8k, masterpiece, best quality Negative prompt: blurry, low quality, distorted, watermark, text

Crear un script de inicio

cat > ~/stable-diffusion-webui/start.sh << 'EOF' #!/bin/bash cd ~/stable-diffusion-webui ./webui.sh --listen --xformers --enable-insecure-extension-access EOF chmod +x ~/stable-diffusion-webui/start.sh
Tip

Si tu GPU tiene 8 GB de VRAM, te recomendamos iniciarla con --medvram --xformers. Para los modelos SDXL se recomiendan al menos 10 GB de VRAM si quieres la mejor experiencia. Los modelos de la serie SD 1.5 funcionan sin problemas con solo 4 GB de VRAM.


ComfyUI

ComfyUI es una herramienta de generación de imágenes con IA basada en nodos: construye flujos de generación mediante conexiones visuales entre nodos, lo que ofrece una flexibilidad extrema.

Instalar ComfyUI

# Install system dependencies sudo apt install -y git python3 python3-venv python3-pip # Clone ComfyUI cd ~ git clone https://github.com/comfyanonymous/ComfyUI.git cd ComfyUI # Create a Python virtual environment python3 -m venv venv source venv/bin/activate # Install PyTorch (CUDA version) pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126 # Install ComfyUI dependencies pip install -r requirements.txt

Iniciar ComfyUI

cd ~/ComfyUI source venv/bin/activate # Launch (default port 8188) python main.py # Allow remote access python main.py --listen 0.0.0.0 --port 8188 # Low VRAM mode python main.py --lowvram

Instalar modelos

La estructura de directorios de modelos de ComfyUI es la siguiente:

# Model directories ls ~/ComfyUI/models/ # checkpoints/ -- Checkpoint models # clip/ -- CLIP models # loras/ -- LoRA models # vae/ -- VAE models # controlnet/ -- ControlNet models # upscale_models/ -- Upscaling models # You can reuse AUTOMATIC1111 models via symlinks ln -s ~/stable-diffusion-webui/models/Stable-diffusion/* ~/ComfyUI/models/checkpoints/ ln -s ~/stable-diffusion-webui/models/Lora/* ~/ComfyUI/models/loras/ ln -s ~/stable-diffusion-webui/models/VAE/* ~/ComfyUI/models/vae/

Flujos de trabajo con nodos

ComfyUI usa nodos y conexiones para construir flujos de generación de imágenes:

  1. Abre tu navegador en http://localhost:8188
  2. El flujo de trabajo predeterminado incluye los nodos básicos de txt2img
  3. Haz clic derecho sobre el lienzo para añadir nodos nuevos
  4. Haz clic en “Queue Prompt” para empezar a generar

Instalar ComfyUI Manager (recomendado):

# ComfyUI Manager makes it easy to manage custom nodes cd ~/ComfyUI/custom_nodes git clone https://github.com/ltdrdata/ComfyUI-Manager.git # After restarting ComfyUI, a Manager button will appear in the interface

Nodos personalizados populares

cd ~/ComfyUI/custom_nodes # Advanced ControlNet nodes git clone https://github.com/Fannovel16/comfyui_controlnet_aux.git # IP-Adapter nodes (style transfer) git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus.git # Image upscaling nodes git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git # Install dependencies for each node cd ~/ComfyUI source venv/bin/activate for dir in custom_nodes/*/; do if [ -f "$dir/requirements.txt" ]; then pip install -r "$dir/requirements.txt" fi done
Note

ComfyUI tiene una curva de aprendizaje más pronunciada que AUTOMATIC1111 WebUI, pero ofrece mayor flexibilidad y reproducibilidad. Empieza con el flujo de trabajo predeterminado y añade poco a poco nodos más complejos. Puedes descargar flujos de trabajo compartidos por la comunidad desde https://comfyworkflows.com  o https://openart.ai/workflows .


OpenAI Whisper

OpenAI Whisper es un potente modelo de reconocimiento de voz que admite la conversión de voz a texto en varios idiomas con una precisión altísima.

Instalar Whisper

# Install system dependencies sudo apt install -y python3 python3-pip python3-venv ffmpeg # Create a virtual environment (recommended) python3 -m venv ~/whisper-env source ~/whisper-env/bin/activate # Install Whisper pip install openai-whisper # Or install with GPU acceleration (requires CUDA) pip install openai-whisper torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

Convertir voz a texto

# Activate virtual environment source ~/whisper-env/bin/activate # Basic usage: transcribe an audio file whisper audio.mp3 --language en --model medium # Specify output format whisper audio.mp3 --language en --model medium --output_format txt whisper audio.mp3 --language en --model medium --output_format srt # Subtitle format whisper audio.mp3 --language en --model medium --output_format vtt # WebVTT format whisper audio.mp3 --language en --model medium --output_format json # Auto-detect language whisper audio.mp3 --model medium # Specify output directory whisper audio.mp3 --language en --model medium --output_dir ~/transcripts/

Tamaños de los modelos de Whisper

ModeloParámetrosVRAM necesariaVelocidad relativaPrecisión
tiny39M~1 GBLa más rápidaAceptable
base74M~1 GBMuy rápidaBuena
small244M~2 GBRápidaMejor
medium769M~5 GBMediaMuy buena
large-v31.5B~10 GBMás lentaLa mejor
turbo809M~6 GBRápidaMuy buena
# Use different model sizes whisper audio.mp3 --model tiny # Fast but lower accuracy whisper audio.mp3 --model small # Balance of speed and accuracy whisper audio.mp3 --model large-v3 # Highest accuracy whisper audio.mp3 --model turbo # Balance of speed and large model accuracy

Uso con Python

import whisper # Load model model = whisper.load_model("medium") # Transcribe audio result = model.transcribe("audio.mp3", language="en") # Output text print(result["text"]) # Output segments with timestamps for segment in result["segments"]: print(f"[{segment['start']:.1f}s - {segment['end']:.1f}s] {segment['text']}")

Usar faster-whisper (recomendado)

faster-whisper usa el motor CTranslate2 y es 4 veces más rápido que el Whisper original, con un uso de VRAM menor.

# Install faster-whisper pip install faster-whisper
from faster_whisper import WhisperModel # Load model (auto-downloads) model = WhisperModel("medium", device="cuda", compute_type="float16") # Transcribe segments, info = model.transcribe("audio.mp3", language="en") print(f"Detected language: {info.language}, confidence: {info.language_probability:.2f}") for segment in segments: print(f"[{segment.start:.1f}s -> {segment.end:.1f}s] {segment.text}")
# faster-whisper command line usage pip install faster-whisper-cli faster-whisper audio.mp3 --language en --model medium --output_format srt

Procesar audio por lotes

# Create a batch transcription script cat > ~/transcribe.sh << 'SCRIPT' #!/bin/bash # Batch transcribe all audio files in a directory INPUT_DIR="${1:-.}" OUTPUT_DIR="${2:-./transcripts}" MODEL="${3:-medium}" source ~/whisper-env/bin/activate mkdir -p "$OUTPUT_DIR" for file in "$INPUT_DIR"/*.{mp3,wav,m4a,flac,ogg}; do [ -f "$file" ] || continue echo "Transcribing: $file" whisper "$file" --language en --model "$MODEL" \ --output_format srt --output_dir "$OUTPUT_DIR" done echo "Transcription complete! Results saved to $OUTPUT_DIR" SCRIPT chmod +x ~/transcribe.sh # Use the script # ~/transcribe.sh ~/audio_files ~/output medium
Tip

Para transcribir de forma general, el modelo medium ofrece el mejor equilibrio entre precisión y velocidad. Para la máxima precisión, usa large-v3. Para transcripción en tiempo real o para procesar grandes volúmenes de archivos, usa faster-whisper: ofrece una mejora de velocidad de aproximadamente 4 veces con el mismo nivel de precisión.


Comparación de herramientas

HerramientaTipo¿Requiere GPU?Ideal para
AUTOMATIC1111 WebUIGeneración de imágenes4GB+Todas las funciones, fácil para principiantes
ComfyUIGeneración de imágenes4GB+Flujos de trabajo avanzados, reproducibilidad
WhisperVoz a textoOpcionalTranscripción de audio, subtítulos
faster-whisperVoz a textoRecomendadaProcesamiento de audio de gran volumen
Last updated on