# AI -\> Image to Text

**URL:** <https://community.glideapps.com/t/ai-image-to-text/69524>\
**Category:** Ask for Help\
**Created:** [January 13, 2024, 1:37am UTC](https://community.glideapps.com/t/ai-image-to-text/69524 "2024-01-13T01:37:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrzej\_Sobczak](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrzej_sobczak/32/69163_2.png) [@Andrzej\_Sobczak](https://community.glideapps.com/u/Andrzej_Sobczak)\
**Post date:** [January 13, 2024, 1:37am UTC](https://community.glideapps.com/t/ai-image-to-text/69524/1 "2024-01-13T01:37:00Z")

</div>

Hi All,

Goal: The user uploads a UML / BPMN diagram (picture), and the app analyzes and evaluates it using AI mechanisms.

Question: Is there a way to invoke Python or JavaScript code from within Glide to perform image analysis (specifically using the gpt-4-vision-preview model)? Can Make/Zapier be used for this?

I tried using the AI Image2Text feature in Glide, but it doesn’t work well for me (by the way, which model does Glide use - from Google or OpenAI, and is there a way to customize the prompt used by Glide)?

## Code:

from openai import OpenAI

api\_key = ‘sk-…’

image\_url = “[https://cdn-images.visual-paradigm.com/tutorials/howtodrawsequencediagram\_screenshots/23-final-uml-sequence-diagram.png](https://cdn-images.visual-paradigm.com/tutorials/howtodrawsequencediagram_screenshots/23-final-uml-sequence-diagram.png)”

client = OpenAI(api\_key=api\_key)

response = client.chat.completions.create(  
model=“gpt-4-vision-preview”,  
messages=[  
{  
“role”: “user”,  
“content”: [  
{“type”: “text”, “text”: “What does the diagram show - describe it in Polish and find any errors in it.”},  
{  
“type”: “image\_url”,  
“image\_url”: {  
“url”: image\_url,  
“detail”: “high”  
},  
},  
],  
}  
],  
max\_tokens=700,  
)

Best Regards,  
Andrzej

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 13, 2024, 3:05pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/2 "2024-01-13T15:05:19Z")

</div>

> [@Andrzej\_Sobczak](#):
>
> I tried using the AI Image2Text feature in Glide, but it doesn’t work well for me (by the way, which model does Glide use - from Google or OpenAI, and is there a way to customize the prompt used by Glide)?

I believe they use OpenAI’s model under the hood, but I’m not entirely sure. I assume you are using the “Image to Text” column, but “Complete chat” might actually be what you need instead.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/9/49dcf9ceb6c88e75735607be9d51fc6143c736ad.png)

It allows you to add an image, and ask a question, whilst “Image to text” doesn’t allow you to specify a prompt, I believe.

---

<div class="post-metadata">

**Author:** ![Andrzej\_Sobczak](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrzej_sobczak/32/69163_2.png) [@Andrzej\_Sobczak](https://community.glideapps.com/u/Andrzej_Sobczak)\
**Post date:** [January 13, 2024, 11:57pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/3 "2024-01-13T23:57:14Z")

</div>

@ThinhDinh Thank you very much!  
First tests show that it works much better. There is not always a stable answer - but I will definitely test this method.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 14, 2024, 10:39am UTC](https://community.glideapps.com/t/ai-image-to-text/69524/4 "2024-01-14T10:39:23Z")

</div>

Ooh this could be helpful for my recent new question- thanks!

---

<div class="post-metadata">

**Author:** ![nixkulinax](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nixkulinax/32/73708_2.png) [@nixkulinax](https://community.glideapps.com/u/nixkulinax)\
**Post date:** [April 17, 2024, 12:54am UTC](https://community.glideapps.com/t/ai-image-to-text/69524/5 "2024-04-17T00:54:58Z")

</div>

Can you check if it works for you? I am trying to use an image in different ways but always receive the same error:

> Complete chat: Invalid type for messages[1].content[1]image\_url: expected an object, but got a string instead.

@David

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 17, 2024, 11:08pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/6 "2024-04-17T23:08:54Z")

</div>

Please try a model that has the “vision” capability. In my test, “gpt-4-1106-vision-preview” works.

---

<div class="post-metadata">

**Author:** ![christian\_k](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/christian_k/32/49583_2.png) [@christian\_k](https://community.glideapps.com/u/christian_k)\
**Post date:** [June 3, 2024, 3:22pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/7 "2024-06-03T15:22:47Z")

</div>

Maybe it worked, but now it doesn’t (anymore). I was just trying gpt-4-turbo-2024-04-09 (also tried gpt-4o etc.) and got the same error:

`Invalid type for 'messages[1].content[1].image_url': expected an object, but got a string instead.`

Tried with different fields, too (conditional, template, file). Any ideas? Has the integration changed?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 3, 2024, 11:39pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/8 "2024-06-03T23:39:45Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/a/aabed8d5c0dc6ae7ff7c451307027f90e012f9c3.png)

If you’re using Image to Text (which is the column mentioned in the post title), it’s working for me.

---

<div class="post-metadata">

**Author:** ![christian\_k](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/christian_k/32/49583_2.png) [@christian\_k](https://community.glideapps.com/u/christian_k)\
**Post date:** [June 4, 2024, 3:30pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/9 "2024-06-04T15:30:00Z")

</div>

Ehm I see, no, I am using “Complete chat” with the OpenAI integration.

---

<div class="post-metadata">

**Author:** ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)\
**Post date:** [June 4, 2024, 10:03pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/10 "2024-06-04T22:03:38Z")

</div>

Unrelated but I swore Image to Text previously cost only 1 update and not 2…

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 4, 2024, 11:49pm UTC](https://community.glideapps.com/t/ai-image-to-text/69524/11 "2024-06-04T23:49:05Z")

</div>

@Jeremy Can you check this? Thank you.

> [@christian\_k](#):
>
> Invalid type for ‘messages[1].content[1].image\_url’: expected an object, but got a string instead.

Also, as you have a paid plan, you can chat with the team using the Intercom messenger.

`We have now launched the intercom messenger in the builder. Instead of submitting a ticket, folks with paid plans can use the messenger to contact support. We'll be updating docs as soon as we have the full details!`
