Explore Workers AI Models Using a Jupyter Notebook
A handy way to explore all of the models available on Workers AI is to use a Jupyter Notebook ↗.
You can download the Workers AI notebook or view the embedded notebook below.
Or you can run this on Google Colab ↗
Workers AI allows you to run machine learning models, on the Cloudflare network, from your own code – whether that be from Workers, Pages, or anywhere via REST API.
This notebook will explore the Workers AI REST API using the official Python SDK ↗.
To use the API you'll need your Cloudflare Account ID ↗. Head to AI > Workers AI page and press the "Use REST API". This page will let you create a new API Token and copy your Account ID.
If you want to add these values to your environment variables, you can create a new file named .env
and this notebook will read those values.
Otherwise you can just enter the values securely when prompted below.
Explore all Text Generation Models
Executing cells in Jupyter Notebooks can be done quickly and efficiently using various keyboard shortcuts, saving you time and effort. Here are the shortcuts you can use:
Mac
- Shift + Enter: Execute the current cell and insert a new cell below.
- Ctrl + Enter: Execute the current cell and insert a new cell below, without creating a new output display.
Windows/Linux
- Shift + Enter: Execute the current cell and insert a new cell below.
- Ctrl + Enter: Execute the current cell and move to the next cell.
Additional Shortcuts
- Alt + Enter: Execute the current cell and create a new output display below (Mac), or move to the next cell (Windows/Linux).
- Ctrl + Shift + Enter: Execute the current cell and create a new output display below (Mac), or create a new cell below (Windows/Linux).
Tips and Tricks
- You can also use the Run Cell button in the Jupyter Notebook toolbar, or the Run menu option (macOS) or Run -> Run Cell (Windows/Linux).
- To execute a selection of cells, use Shift + Alt + Enter (Mac) or Shift + Ctrl + Enter (Windows/Linux).
- To execute a cell and move to the next cell, use Ctrl + Shift + Enter (all platforms).
By using these keyboard shortcuts, you'll be able to work more efficiently and quickly in your Jupyter Notebooks. Happy coding!
Explore all Text to Image models
Explore all Image to Text models
The image features a display of various colored lava lamps. There are at least 14 lava lamps in the scene, each with a different color and design. The lamps are arranged in a visually appealing manner, with some placed closer to the foreground and others further back. The display creates an eye-catching and vibrant atmosphere, showcasing the diverse range of lava lamps available.
Explore all Speech Recognition models
Explore all Translation models
La inteligencia artificial es bastante impresionante en estos días.Es un buen momento para ser un constructor
Explore all Text Classification models
[TextClassification(label='NEGATIVE', score=0.00012679687642958015), TextClassification(label='POSITIVE', score=0.999873161315918)]
Explore all Image Classification models
[TextClassification(label='BURRITO', score=0.9999679327011108), TextClassification(label='GUACAMOLE', score=8.516660273016896e-06), TextClassification(label='BAGEL', score=4.689153229264775e-06), TextClassification(label='SPATULA', score=4.075985089002643e-06), TextClassification(label='POTPIE', score=3.0849002996546915e-06)]
Explore all Summarization based models
8116
'The Declaration of Independence was signed by the thirteen states on July 4, 1776. It was the first attempt at a U.S. Constitution. It declared the right of the people to change their Government.'