Skip to content

Commit

Permalink
Merge pull request #33 from predictionguard/switch-images
Browse files Browse the repository at this point in the history
updating example images to stock images.
  • Loading branch information
jmansdorfer authored Aug 9, 2024
2 parents 25495e8 + b159dd6 commit 5128edb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions fern/docs/pages/reference/chat_vision.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ images that are base64 encoded represented by a data uri.
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
"url": "https://pbs.twimg.com/media/GKLN4qPXEAArqoK.png",
}
}
]
Expand Down Expand Up @@ -97,7 +97,7 @@ images that are base64 encoded represented by a data uri.
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

image, err := client.NewImageNetwork("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")
image, err := client.NewImageNetwork("https://pbs.twimg.com/media/GKLN4qPXEAArqoK.png")
if err != nil {
return fmt.Errorf("ERROR: %w", err)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ images that are base64 encoded represented by a data uri.
const client = new pg.Client('https://api.predictionguard.com', process.env.PREDICTIONGUARD_API_KEY);

async function ChatVision() {
const image = new pg.ImageNetwork('https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg');
const image = new pg.ImageNetwork('https://pbs.twimg.com/media/GKLN4qPXEAArqoK.png');

const input = {
role: pg.Roles.User,
Expand All @@ -192,9 +192,9 @@ images that are base64 encoded represented by a data uri.
<CodeBlock title="cURL">
```bash
curl -O 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg'
curl -O 'https://pbs.twimg.com/media/GKLN4qPXEAArqoK.png'

base64_img="$(base64 -i 2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg)"
base64_img="$(base64 -i GKLN4qPXEAArqoK.png)"

cat <<EOF > input.json
{
Expand Down Expand Up @@ -232,16 +232,16 @@ The output will look something like:
```json
{
"id":"chat-xQNsuexunK7zeMjlW25g99hax9qo4",
"id":"chat-zstjj2MKpRdKfBmCMILK9wgx7I09N",
"object":"chat_completion",
"created":1717784541,
"created":1723228682,
"model":"llava-1.5-7b-hf",
"choices":[
{
"index":0,
"message":{
"role":"assistant",
"content":"The image features a peaceful scene of a wooden pathway traveling through an open grassy field. The pathway seems to be leading to an even more remote and expansive meadow, providing a serene and picturesque view. The surroundings consist of lush green grass and trees, creating a sense of tranquility in the landscape.",
"content":"In the image, there is a person standing on the back of a vehicle in a city. The vehicle is situated next to a taxi on the street. Another car can be seen approaching, and there is also a traffic light visible in the scene. The person standing on the vehicle could be a man drying his clothes, creating a unique and eye-catching sight. Additionally, a handbag is present near the person riding on the vehicle, likely belonging to them.",
"output":null
},
"status":"success"
Expand Down
12 changes: 6 additions & 6 deletions fern/docs/pages/usingllms/chat_vision.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ messages = [
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
"url": "https://pbs.twimg.com/media/GKLN4qPXEAArqoK.png",
}
}
]
Expand Down Expand Up @@ -68,7 +68,7 @@ messages = [
{
"type": "image_url",
"image_url": {
"url": "image_data/Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
"url": "GKLN4qPXEAArqoK.png",
}
}
]
Expand Down Expand Up @@ -104,7 +104,7 @@ def encode_image_to_base64(image_path):
base64_message = base64_encoded_data.decode('utf-8')
return base64_message

image_path = 'image_data/Gfp-wisconsin-madison-the-nature-boardwalk.jpg'
image_path = 'GKLN4qPXEAArqoK.png'
encoded_image = encode_image_to_base64(image_path)

```
Expand Down Expand Up @@ -187,15 +187,15 @@ The output of these will be similar to this:
{
"index": 0,
"message": {
"content": "The image features a beautiful wooden path lined with green grass and a blue sky overhead. The pathway leads towards a body of water, creating a serene atmosphere. Along the path, there is a bench overlooking the pond, inviting to sit and relax. The scene also includes trees in the background, adding to the picturesque scenery.\nWith the combination of the peaceful atmosphere, the sunny blue sky, and the presence of water nearby, this image",
"content": "In the image, there is a person standing on the back of a vehicle in a city. The vehicle is situated next to a taxi on the street. Another car can be seen approaching, and there is also a traffic light visible in the scene. The person standing on the vehicle could be a man drying his clothes, creating a unique and eye-catching sight. Additionally, a handbag is present near the person riding on the vehicle, likely belonging to them",
"output": null,
"role": "assistant"
},
"status": "success"
}
],
"created": 1722545890,
"id": "chat-xX9FDkWknG8G0ZHQjCgNdp47uBQZy",
"created": 1723228682,
"id": "chat-zstjj2MKpRdKfBmCMILK9wgx7I09N",
"model": "llava-1.5-7b-hf",
"object": "chat_completion"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ paths:
value:
model: "bridgetower-large-itm-mlm-itc"
input:
- text: "This is Bill Kennedy, a decent Go developer."
- text: "A person is ironing something while standing on the back of a taxi."
image: "<base64 encoded image>"
responses:
"403":
Expand Down

0 comments on commit 5128edb

Please sign in to comment.