image_to_text.py with the following code:
image_to_text.py
Usage
1
Create a virtual environment
Open the
Terminal and create a python virtual environment.2
Install libraries
3
Run the agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
image_to_text.py with the following code:
from pathlib import Path
from phi.agent import Agent
from phi.model.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
markdown=True,
)
image_path = Path(__file__).parent.joinpath("multimodal-agents.jpg")
agent.print_response(
"Write a 3 sentence fiction story about the image",
images=[str(image_path)],
)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
python3 -m venv aienv
aienv/scripts/activate
Install libraries
pip install openai phidata
Run the agent
python image_to_text.py
Was this page helpful?