Skip to content

Commit

Permalink
Update the test data
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Nov 26, 2024
1 parent e3970f6 commit 0b2c3d9
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 143 deletions.
9 changes: 3 additions & 6 deletions tests/cypress/plugins/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as chatgptData from '../../test-plugin/chatgpt.json';
import * as chatgptCustomExcerptData from '../../test-plugin/chatgpt-custom-excerpt-prompt.json';
import * as chatgptCustomTitleData from '../../test-plugin/chatgpt-custom-title-prompt.json';
import * as dalleData from '../../test-plugin/dalle.json';
import * as ocrData from '../../test-plugin/ocr.json';
import * as whisperData from '../../test-plugin/whisper.json';
import * as imageData from '../../test-plugin/image_analyze.json';
import * as pdfData from '../../test-plugin/pdf.json';
Expand Down Expand Up @@ -99,7 +98,7 @@ export const getWhisperData = () => {
*/
export const getOCRData = () => {
const words = [];
ocrData.regions.forEach( ( el ) => {
imageData.readResult.blocks.forEach( ( el ) => {
el.lines.forEach( ( el2 ) => {
el2.words.forEach( ( el3 ) => {
words.push( el3.text );
Expand All @@ -116,10 +115,8 @@ export const getOCRData = () => {
*/
export const getImageData = () => {
const data = {
altText: imageData.description.captions.filter(
( el ) => el.confidence > 0.75
)[ 0 ].text,
tags: imageData.tags
altText: imageData.captionResult.text,
tags: imageData.tagsResult.values
.filter( ( el ) => el.confidence > 0.7 )
.map( ( el ) => el.name ),
};
Expand Down
4 changes: 1 addition & 3 deletions tests/test-plugin/e2e-test-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ function classifai_test_mock_http_requests( $preempt, $parsed_args, $url ) {
strpos( $url, 'https://e2e-test-azure-openai-embeddings.test/openai/deployments' ) !== false
) {
$response = file_get_contents( __DIR__ . '/embeddings.json' );
} elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/analyze' ) !== false ) {
} elseif ( strpos( $url, 'http://e2e-test-image-processing.test/computervision/imageanalysis:analyze?api-version=2024-02-01' ) !== false ) {
$response = file_get_contents( __DIR__ . '/image_analyze.json' );
} elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/ocr' ) !== false ) {
$response = file_get_contents( __DIR__ . '/ocr.json' );
} elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/generateThumbnail' ) !== false ) {
$response = file_get_contents( __DIR__ . '../classifai/assets/img/icon256x256.png' );
} elseif ( strpos( $url, 'http://e2e-test-image-processing.test/pdf-read-result' ) !== false ) {
Expand Down
242 changes: 167 additions & 75 deletions tests/test-plugin/image_analyze.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,173 @@
{
"tags": [
{
"name": "text",
"confidence": 0.9854570031166077
},
{
"name": "design",
"confidence": 0.9676092863082886
},
{
"name": "screenshot",
"confidence": 0.9044408798217773
},
{
"name": "graphic",
"confidence": 0.8791931867599487
},
{
"name": "red",
"confidence": 0.8448371887207031
},
{
"name": "font",
"confidence": 0.8189171552658081
},
{
"name": "graphics",
"confidence": 0.7044017314910889
},
{
"name": "logo",
"confidence": 0.6639798283576965
},
{
"name": "typography",
"confidence": 0.6407877802848816
},
{
"name": "maroon",
"confidence": 0.6387392282485962
},
{
"name": "illustration",
"confidence": 0.6350329518318176
},
{
"name": "carmine",
"confidence": 0.6345877647399902
},
{
"name": "abstract",
"confidence": 0.624541163444519
},
{
"name": "vector graphics",
"confidence": 0.21607014536857605
},
{
"name": "clipart",
"confidence": 0.20682862401008606
}
],
"description": {
"tags": [
"text"
],
"captions": [
{
"text": "text",
"confidence": 0.8448402285575867
"modelVersion": "2023-10-01",
"metadata": {
"height": 250,
"width": 772
},
"tagsResult": {
"values": [
{
"name": "text",
"confidence": 0.9854570031166077
},
{
"name": "design",
"confidence": 0.9676092863082886
},
{
"name": "screenshot",
"confidence": 0.9044408798217773
},
{
"name": "graphic",
"confidence": 0.8791931867599487
},
{
"name": "red",
"confidence": 0.8448371887207031
},
{
"name": "font",
"confidence": 0.8189171552658081
},
{
"name": "graphics",
"confidence": 0.7044017314910889
},
{
"name": "logo",
"confidence": 0.6639798283576965
},
{
"name": "typography",
"confidence": 0.6407877802848816
},
{
"name": "maroon",
"confidence": 0.6387392282485962
},
{
"name": "illustration",
"confidence": 0.6350329518318176
},
{
"name": "carmine",
"confidence": 0.6345877647399902
},
{
"name": "abstract",
"confidence": 0.624541163444519
},
{
"name": "vector graphics",
"confidence": 0.21607014536857605
},
{
"name": "clipart",
"confidence": 0.20682862401008606
}
]
},
"requestId": "50fdeac0-9ef5-4e81-9e05-d392d15907ca",
"metadata": {
"height": 250,
"width": 772,
"format": "Png"
"captionResult": {
"text": "Text",
"confidence": 0.8448402285575867
},
"readResult": {
"blocks": [
{
"lines": [
{
"text": "CLASSIFAI_",
"boundingPolygon": [
{
"x": 193,
"y": 337
},
{
"x": 614,
"y": 348
},
{
"x": 617,
"y": 507
},
{
"x": 187,
"y": 510
}
],
"words": [
{
"text": "CLASSIFAI_",
"boundingPolygon": [
{
"x": 188,
"y": 337
},
{
"x": 600,
"y": 341
},
{
"x": 599,
"y": 511
},
{
"x": 187,
"y": 510
}
],
"confidence": 0.991
}
]
},
{
"text": "Test",
"boundingPolygon": [
{
"x": 193,
"y": 337
},
{
"x": 614,
"y": 348
},
{
"x": 617,
"y": 507
},
{
"x": 187,
"y": 510
}
],
"words": [
{
"text": "Test",
"boundingPolygon": [
{
"x": 188,
"y": 337
},
{
"x": 600,
"y": 341
},
{
"x": 599,
"y": 511
},
{
"x": 187,
"y": 510
}
],
"confidence": 0.991
}
]
}
]
}
]
}
}
59 changes: 0 additions & 59 deletions tests/test-plugin/ocr.json

This file was deleted.

0 comments on commit 0b2c3d9

Please sign in to comment.