Beyond Text: Exploring the World of Multimodal Generative AI

Generative AI is moving beyond text. How multimodal models combine text, images, audio, and video, with working code examples and where the technology is being used.

Vinay Adiga

· 14 min read

Share:

Multimodal learning is the main reason 2025 is shaping up as a big year for AI in business. Older models handled only text. Multimodal models also work with images, video, and audio, so they pick up much more context and give answers that are more accurate and feel more natural.

For businesses, that means AI can now analyze mixed-media data such as scanned documents, product photos, call recordings, and video, and fit into workflows that span several formats.

The main benefits:

  • Better grasp of context. A model that sees the image, hears the audio, and reads the text together interprets a situation more like a person would, and answers more accurately.
  • Richer, more personal output. Learning from several modalities lets a model tailor its output closely to the user, which makes interactions feel more natural.
  • New data applications. Businesses can analyze complex mixed-media data, simplify workflows that span formats, and put AI-driven insight in front of more people.
  • Creative tools. Artists, writers, and other creators can illustrate a story instantly or animate a concept.
  • Accessibility. Multimodal models can describe images for people with visual impairments or translate sign language in real time.

Multimodal Input: The Next Leap in AI Interaction

Multimodal AI also changes how we talk to it. The latest systems accept several kinds of input at once, so a conversation with AI feels closer to one with another person.

Understanding Multimodal Input Capabilities

Modern multimodal LLMs like GPT-4V, Claude 3 Opus, and Gemini Pro can now process:

  • Images alongside text queries: “What’s in this image?” or “Can you describe what’s wrong with this circuit diagram?”
  • Audio alongside text: “Translate this speech recording” or “What emotions do you detect in this audio clip?”
  • Video understanding: “Summarize what happens in this video clip” or “Identify the key events in this recording”

That is much closer to how people naturally communicate. The Python snippet below uses CLIP, a model that relates images to text, to rank possible findings for a chest X-ray.

from transformers import CLIPProcessor, CLIPModel
import torch
from PIL import Image
import requests
# Load a CLIP model (this can be finetuned on medical data)
model_name = "openai/clip-vit-base-patch32"
model = CLIPModel.from_pretrained(model_name)
processor = CLIPProcessor.from_pretrained(model_name)
# Example image URL
image_url = "https://example.com/chest_xray.jpg"
try:
response = requests.get(image_url, stream=True)
response.raise_for_status()
image = Image.open(response.raw)
except Exception as e:
print(f"Error loading image: {e}")
image = Image.new('RGB', (224, 224), color='gray')
medical_texts = [
"a normal chest X-ray with clear lungs",
"chest X-ray showing pneumonia",
"chest X-ray with pleural effusion",
"chest X-ray showing pneumothorax",
"chest X-ray with enlarged heart",
"chest X-ray showing pulmonary edema",
"chest X-ray with lung collapse",
"chest X-ray showing lung nodules",
"chest X-ray with lung consolidation",
"chest X-ray showing emphysema"
]
inputs = processor(
text=medical_texts,
images=image,
return_tensors="pt",
padding=True
)
with torch.no_grad():
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image
probabilities = torch.softmax(logits_per_image, dim=-1)
# Get top predictions
top_indices = torch.argsort(probabilities, descending=True)[0]
print("Medical findings analysis for chest X-ray:")
print("-" * 50)
for i in range(min(5, len(medical_texts))):
idx = top_indices[i]
finding = medical_texts[idx]
confidence = probabilities[0][idx].item()
print(f"{finding}: {confidence:.3f} ({confidence*100:.1f}%)")
print(f"\nMost likely finding: {medical_texts[top_indices[0]]}")
print(f"Confidence: {probabilities[0][top_indices[0]].item()*100:.1f}%")

Real-Time Multimodal Communication

Real-time multimodal communication is now practical too. Libraries like FastRTC make it straightforward to build applications that process audio, video, and text as they stream in:

from fastrtc import Stream, ReplyOnPause, get_stt_model, get_tts_model
from google import genai
stt_model = get_stt_model()
tts_model = get_tts_model()
client = genai.Client(api_key="GEMINI_API_KEY")
def voice_llm_chat(audio):
# Convert speech to text
user_message = stt_model.stt(audio)
response = client.models.generate_content(
model="gemini-1.5-flash",
contents=user_message,
config={"max_output_tokens": 200,}
)
# Convert response to speech
ai_response = response.text
for audio_chunk in tts_model.stream_tts_sync(ai_response):
yield audio_chunk
# Create and launch the stream
stream = Stream(ReplyOnPause(voice_llm_chat), modality="audio", mode="send-receive")
stream.ui.launch()

In about twenty lines, this builds a voice assistant that transcribes speech, sends it to an LLM, and speaks the reply back in real time.

Multimodal Context Windows and Chain-of-Thought

The latest multimodal models can maintain context across different modalities. For example:

The user can ask follow-up questions about the image without uploading it again. Here is a conceptual example:

conversation = [
{"role": "user", "content": [
{"type": "text", "text": "Can you explain what's happening in this circuit?"},
{"type": "image", "image_url": "https://example.com/circuit_diagram.jpg"}
]},
{"role": "assistant", "content": "This appears to be an amplifier circuit using a transistor. The input signal comes in through the capacitor C1 on the left."},
{"role": "user", "content": "What would happen if I increased R2's resistance?"},
{"role": "assistant", "content": "If you increase R2 (the resistor connected to the collector), you would increase the gain of the amplifier but potentially reduce the maximum output swing due to the voltage drop across R2."}
]

Video Understanding and Processing

AI systems can now also understand video, which means combining spatial understanding (what is in each frame) with temporal understanding (how things change over time). This example samples frames from a video and classifies the action in it:

import os
import cv2
import numpy as np
import torch
from transformers import AutoProcessor, AutoModelForVideoClassification
model_name = "MCG-NJU/videomae-base-finetuned-ssv2"
# Load model for video classification
processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForVideoClassification.from_pretrained(model_name)
if torch.cuda.is_available():
model.to("cuda")
def analyze_video(video_path, sample_frames=16):
if not os.path.exists(video_path):
print(f"Error: Video file not found at {video_path}")
return []
cap = cv2.VideoCapture(video_path)
if not cap.isOpened():
print(f"Error: Could not open video file at {video_path}")
return []
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
if frame_count == 0:
print(f"Error: No frames found in video at {video_path}")
cap.release()
return []
actual_sample_count = min(sample_frames, frame_count)
indices = np.linspace(0, frame_count - 1, actual_sample_count, dtype=int)
frames = []
for i in indices:
cap.set(cv2.CAP_PROP_POS_FRAMES, i)
ret, frame = cap.read()
if ret:
# Convert BGR (OpenCV default) to RGB
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
frames.append(frame)
cap.release()
if not frames:
print(f"Warning: No frames extracted from {video_path}.")
return []
if len(frames) < sample_frames:
while len(frames) < sample_frames:
frames.append(frames[-1])
elif len(frames) > sample_frames:
frames = frames[:sample_frames]
inputs = processor(images=frames, return_tensors="pt")
# Move inputs to GPU if available
if torch.cuda.is_available():
inputs = {k: v.to("cuda") for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
probs = torch.nn.functional.softmax(outputs.logits, dim=-1)
k = min(3, probs.shape[-1])
top_prob, top_label_indices = torch.topk(probs, k=k)
predicted_labels = []
for prob, label_idx in zip(top_prob[0], top_label_indices[0]):
predicted_labels.append((model.config.id2label[label_idx.item()], prob.item()))
return predicted_labels
results = analyze_video("painting.mp4")
if results:
print("\n--- Video Classification Results ---")
for label, confidence in results:
print(f"{label}: {confidence:.4f}")
else:
print("Could not analyze video or no results obtained.")

With models like Gemini Pro and SmolVLM2, developers can build applications that understand video, answer questions about it, and describe it.

Key Modalities and Examples

  • Text & Image: The most mature pairing, with strong text-to-image generation and image captioning models. Here’s a simplified example using the Hugging Face diffusers library to generate an image from a text prompt with Stable Diffusion:

    from diffusers import StableDiffusionPipeline
    import torch
    # Load model
    model_id = "stable-diffusion-v1-5/stable-diffusion-v1-5"
    pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
    pipe = pipe.to("cuda") # Move to GPU
    # Generate image from text
    prompt = "A city after an apocalypse where trees are growing on buildings most buildings are destroyed, futuristic architecture, " \
    "overgrown nature, vibrant colors"
    image = pipe(prompt).images[0]
    image.save("futuristic_city.png")

And here’s a simplified example of image captioning using the BLIP model:

from transformers import BlipProcessor, BlipForConditionalGeneration
from PIL import Image
import requests
# Load model and processor
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
# Load image (from URL or local file)
url = "http://images.cocodataset.org/val2017/000000039769.jpg" # Example: an image of cats
try:
image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
inputs = processor(image, return_tensors="pt")
# Generate caption
out = model.generate(**inputs)
caption = processor.decode(out[0], skip_special_tokens=True)
print(f"Generated caption: {caption}")
except Exception as e:
print(f"Error: {e}")
print("Could not generate caption.")
  • Text & Audio: Generating speech from text (text-to-speech), or music and sound effects from text (text-to-audio).

  • Text & Video: Generating short video clips from text prompts (text-to-video), an area that is improving quickly.

  • Image & Audio: Generating sound effects that fit an image, or the reverse.

  • Combined Modalities & Vision-RAG: Models like GPT-4V(ision) and Google’s Gemini accept text and images together and reason about both. That makes Vision-RAG (Retrieval-Augmented Generation) possible: retrieve the images relevant to a text query, then have a vision-language model (VLM) look at them to answer it.

    Here’s a conceptual overview using Cohere Embed v4 for retrieval and Google Gemini for answering:

import cohere
from google import genai
import numpy as np
from PIL import Image
import requests
from io import BytesIO
import base64
co = cohere.Client("api_key")
genai_client = genai.Client(api_key="api_key")
class SimpleImageDB:
def __init__(self):
self.images = [] # List of (image_url, embedding) tuples
def add_image(self, url, embedding):
self.images.append((url, embedding))
def search(self, query_embedding, top_k=3):
similarities = []
for url, emb in self.images:
# Cosine similarity
similarity = np.dot(query_embedding, emb) / (np.linalg.norm(query_embedding) * np.linalg.norm(emb))
similarities.append((url, similarity))
# Sort by similarity (descending)
return sorted(similarities, key=lambda x: x[1], reverse=True)[:top_k]
image_db = SimpleImageDB()
example_images = [
"https://example.com/1.jpg",
"https://example.com/2.jpg",
]
def url_to_data_uri(image_url):
"""Convert image URL to data URI format required by Cohere API."""
try:
response = requests.get(image_url, timeout=10)
response.raise_for_status()
content_type = response.headers.get('content-type', '')
if 'jpeg' in content_type or 'jpg' in content_type:
mime_type = 'image/jpeg'
elif 'png' in content_type:
mime_type = 'image/png'
else:
mime_type = 'image/jpeg'
image_b64 = base64.b64encode(response.content).decode('utf-8')
data_uri = f"data:{mime_type};base64,{image_b64}"
# Check size (5MB limit)
if len(response.content) > 5 * 1024 * 1024:
raise ValueError("Image size exceeds 5MB limit")
return data_uri
except Exception as e:
raise Exception(f"Failed to process image URL: {e}")
for img_url in example_images:
response = co.embed(
texts=None,
images=[url_to_data_uri(img_url)],
model="embed-v4.0", # Use appropriate model
input_type="image"
)
image_db.add_image(img_url, response.embeddings[0])
def answer_visual_query(text_query):
query_response = co.embed(
texts=[text_query],
model="embed-v4.0",
input_type="text"
)
query_embedding = query_response.embeddings[0]
relevant_images = image_db.search(query_embedding, top_k=2)
image_objects = []
for img_url, similarity in relevant_images:
try:
response = requests.get(img_url)
img = Image.open(BytesIO(response.content))
image_objects.append(img)
except Exception as e:
print(f"Error loading image {img_url}: {e}")
if not image_objects:
return "No relevant images found to answer your query."
prompt = f"""
I need you to analyze these images to answer the following question:
{text_query}
Provide a detailed answer based on what you see in the images.
"""
response = genai_client.models.generate_content(model="gemini-2.0-flash",contents=[prompt] + image_objects)
return response.text
# Example usage
answer = answer_visual_query("What breed of dog is in these images?")
print(answer)

Applications Across Industries

Multimodal AI is already finding uses in many sectors:

  • Creative Arts & Design: Generating unique artwork, music, video storyboards, fashion designs.
  • Marketing & Advertising: Creating ad copy with corresponding images/videos, personalized marketing content.
  • Education & Training: Generating interactive learning materials combining text, visuals, and audio.
  • Entertainment & Gaming: Creating dynamic game assets, virtual worlds, and interactive narratives.
  • Accessibility: Tools for image description, real-time translation including sign language.
  • Healthcare: Assisting in analyzing medical images (like X-rays) alongside patient notes.
  • Robotics: Enabling robots to understand and interact with the world through vision and language.

Challenges in Multimodal AI

Building and deploying multimodal AI is still hard:

  • Data requirements. Training needs very large, high-quality datasets in which the modalities line up (an image paired with an accurate caption, say). Those are hard and expensive to build.
  • Compute cost. Training a large multimodal model takes even more compute than training a text-only LLM.
  • Evaluation. It is hard to define, let alone measure, the quality and coherence of generated multimodal content.
  • Alignment and coherence. Content generated across modalities has to agree: the narration should match the video.
  • Ethics. The same concerns as with LLMs, made worse: bias, deepfakes, and misinformation spread through manipulated images and video.

Advanced Multimodal Input Techniques

Newer techniques let models do more with multimodal input. A few of the most promising follow.

Multimodal Chain-of-Thought Reasoning

Multimodal models can reason across input types, relating what is in the text to what is in an image and reaching conclusions a single-modality model couldn’t. For example:

from transformers import AutoProcessor, AutoModelForVision2Seq
import torch
from PIL import Image
import requests
# Load model and processor
processor = AutoProcessor.from_pretrained("google/pix2struct-textcaps-large")
model = AutoModelForVision2Seq.from_pretrained("google/pix2struct-textcaps-large")
# Example showing multimodal reasoning
def reason_about_image(image_url, question):
# Load image
image = Image.open(requests.get(image_url, stream=True).raw)
# Process with model
inputs = processor(images=image, text=question, return_tensors="pt")
# Generate step-by-step reasoning
outputs = model.generate(
**inputs,
max_length=512,
num_beams=4,
early_stopping=True,
num_return_sequences=1,
length_penalty=1.0,
prefix="Let me think through this step-by-step: "
)
# Decode and return answer
return processor.decode(outputs[0], skip_special_tokens=True)
# Example call
reasoning = reason_about_image(
"https://example.com/complex_chart.jpg",
"What's the relationship between the red and blue lines in this graph, and what conclusions can we draw?"
)
print(reasoning)

This approach allows models to show their thought process, making their conclusions more transparent and interpretable.

Zero-Shot Multimodal Learning

Zero-shot classification means predicting a class the model never saw during training. It is a form of transfer learning: a pre-trained model is used for a task it wasn’t trained for. That is especially useful when you have little labeled data. Here CLIP picks the best label for an image from a list it has never been trained on:

import torch
from PIL import Image
from transformers import CLIPProcessor, CLIPModel
import torch.nn.functional as F
def zero_shot_multimodal_learning_example():
print("--- Zero-Shot Multimodal Learning Example (CLIP) ---")
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
example_image_path = "example-dog.jpg"
example_image = Image.open(example_image_path).convert("RGB")
candidate_labels = [
"a photo of a cat",
"a photo of a dog",
"a photo of a car",
"a photo of an airplane",
"a photo of a flower"
]
for label in candidate_labels:
print(f"- {label}")
inputs = processor(text=candidate_labels, images=example_image, return_tensors="pt", padding=True)
with torch.no_grad():
outputs = model(**inputs)
image_features = outputs.image_embeds
text_features = outputs.text_embeds
image_features = F.normalize(image_features, p=2, dim=-1)
text_features = F.normalize(text_features, p=2, dim=-1)
similarity_scores = (image_features @ text_features.T).squeeze(0)
print("\nSimilarity scores (raw):")
print(similarity_scores)
probabilities = F.softmax(similarity_scores, dim=-1)
print("\nProbabilities:")
print(probabilities)
predicted_index = torch.argmax(probabilities).item()
predicted_label = candidate_labels[predicted_index]
predicted_probability = probabilities[predicted_index].item()
print(f"The image is predicted to be: '{predicted_label}'")
print(f"With probability: {predicted_probability:.4f}")
if __name__ == "__main__":
zero_shot_multimodal_learning_example()

Change the label list and the same model handles a new task, with no retraining.

Foundational Multimodal Models

The most capable multimodal models are generalists. They accept almost any combination of input types and handle a wide range of tasks:

from google import genai
from PIL import Image
import requests
from io import BytesIO
# Configure the API (you would need your API key)
client = genai.Client(api_key="<api_key>")
def process_multimodal_query(text_query, image_urls=None, audio_url=None):
content_parts = [text_query]
if image_urls:
for url in image_urls:
response = requests.get(url)
image = Image.open(BytesIO(response.content))
content_parts.append(image)
if audio_url:
# In a real implementation, you would process the audio file
# and add it to content_parts in the format required by the model
pass
response = client.models.generate_content(model='gemini-2.0-flash', contents=content_parts)
return response.text
response = process_multimodal_query(
"Compare these two drawings. What period are they from, and what are the key stylistic differences?",
image_urls=[
"https://example.com/1.jpg",
"https://example.com/2.jpg"
]
)
print(response)

A single call can compare several images with a text question, and some of these models also take audio or video.

The Future of Multimodal AI

A few trends look likely:

  1. More input types. Future models may process touch, smell (via chemical composition), and 3D spatial data.

  2. Cross-modal transfer learning. Models will get better at using what they learn in one modality to improve in another.

  3. Multimodal AI agents. Autonomous agents will perceive the world through several senses and act across modalities.

  4. Understanding of the physical world. Models will build a fuller picture of how the physical world works, which will improve their reasoning about real situations.

  5. Personalized interfaces. AI systems will adapt to how each user prefers to communicate, moving between text, voice, and visuals as needed.

Conclusion: Embracing the Multimodal Future

Multimodal AI brings us closer to systems that perceive and interact with the world the way people do. As the technology matures, it will open up new forms of creative work, more natural ways to use computers, and useful tools in many industries. Organizations that start experimenting now will be ready to use these advances as they arrive.

At Quabyt, we’re exploring how multimodal AI can help our clients solve hard problems and build new experiences, whether that means better customer engagement, simpler workflows, or entirely new products.