Skip to content

Commit

Permalink
remove unused fns
Browse files Browse the repository at this point in the history
  • Loading branch information
mertyg committed Jul 7, 2024
1 parent 177b0a6 commit d0d7e49
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions examples/notebooks/Tutorial-MultiModal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,7 @@
"# Some utils to read images\n",
"\n",
"import io\n",
"from PIL import Image\n",
"\n",
"def encode_image(image):\n",
" # Convert RGBA to RGB if necessary\n",
" if image.mode == 'RGBA':\n",
" # Create a new image with a white background\n",
" background = Image.new('RGB', image.size, (255, 255, 255))\n",
" # Paste the image on the background.\n",
" background.paste(image, (0, 0), image)\n",
" image = background\n",
"\n",
" # Create a BytesIO object\n",
" buffered = io.BytesIO()\n",
"\n",
" # Save your image object to this BytesIO object (in JPEG format)\n",
" image.save(buffered, format=\"JPEG\")\n",
"\n",
" # Get the byte data from the BytesIO object\n",
" image_byte_data = buffered.getvalue()\n",
"\n",
" # Encode this byte data in base64 and return the string\n",
" return image_byte_data"
"from PIL import Image"
]
},
{
Expand All @@ -75,28 +54,6 @@
"from textgrad.loss import ImageQALoss"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2b06474c-491d-48ff-aef1-62cb0e525473",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from dotenv import load_dotenv\n",
"load_dotenv(\".env\", override=True)"
]
},
{
"cell_type": "code",
"execution_count": 9,
Expand Down

0 comments on commit d0d7e49

Please sign in to comment.