mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
playing with AI image recognition
This commit is contained in:
@@ -22,6 +22,7 @@ models/FoodInheritField.ts
|
||||
models/FoodShoppingUpdate.ts
|
||||
models/FoodSimple.ts
|
||||
models/Group.ts
|
||||
models/ImportImage.ts
|
||||
models/ImportLog.ts
|
||||
models/Ingredient.ts
|
||||
models/IngredientString.ts
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
FoodInheritField,
|
||||
FoodShoppingUpdate,
|
||||
Group,
|
||||
ImportImage,
|
||||
ImportLog,
|
||||
Ingredient,
|
||||
IngredientString,
|
||||
@@ -167,6 +168,8 @@ import {
|
||||
FoodShoppingUpdateToJSON,
|
||||
GroupFromJSON,
|
||||
GroupToJSON,
|
||||
ImportImageFromJSON,
|
||||
ImportImageToJSON,
|
||||
ImportLogFromJSON,
|
||||
ImportLogToJSON,
|
||||
IngredientFromJSON,
|
||||
@@ -662,6 +665,10 @@ export interface ApiGroupRetrieveRequest {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface ApiImageToRecipeCreateRequest {
|
||||
image: string;
|
||||
}
|
||||
|
||||
export interface ApiImportLogCreateRequest {
|
||||
importLog: ImportLog;
|
||||
}
|
||||
@@ -3962,6 +3969,60 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImageToRecipeCreateRaw(requestParameters: ApiImageToRecipeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ImportImage>> {
|
||||
if (requestParameters['image'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'image',
|
||||
'Required parameter "image" was null or undefined when calling apiImageToRecipeCreate().'
|
||||
);
|
||||
}
|
||||
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
if (this.configuration && this.configuration.apiKey) {
|
||||
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
{ contentType: 'multipart/form-data' },
|
||||
];
|
||||
// @ts-ignore: canConsumeForm may be unused
|
||||
const canConsumeForm = runtime.canConsumeForm(consumes);
|
||||
|
||||
let formParams: { append(param: string, value: any): any };
|
||||
let useForm = false;
|
||||
if (useForm) {
|
||||
formParams = new FormData();
|
||||
} else {
|
||||
formParams = new URLSearchParams();
|
||||
}
|
||||
|
||||
if (requestParameters['image'] != null) {
|
||||
formParams.append('image', requestParameters['image'] as any);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/image-to-recipe`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: formParams,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => ImportImageFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImageToRecipeCreate(requestParameters: ApiImageToRecipeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ImportImage> {
|
||||
const response = await this.apiImageToRecipeCreateRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* function to handle files passed by application importer
|
||||
*/
|
||||
|
||||
61
vue3/src/openapi/models/ImportImage.ts
Normal file
61
vue3/src/openapi/models/ImportImage.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Tandoor
|
||||
* Tandoor API Docs
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ImportImage
|
||||
*/
|
||||
export interface ImportImage {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ImportImage
|
||||
*/
|
||||
image: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the ImportImage interface.
|
||||
*/
|
||||
export function instanceOfImportImage(value: object): boolean {
|
||||
if (!('image' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ImportImageFromJSON(json: any): ImportImage {
|
||||
return ImportImageFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ImportImageFromJSONTyped(json: any, ignoreDiscriminator: boolean): ImportImage {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'image': json['image'],
|
||||
};
|
||||
}
|
||||
|
||||
export function ImportImageToJSON(value?: ImportImage | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'image': value['image'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ export * from './FoodInheritField';
|
||||
export * from './FoodShoppingUpdate';
|
||||
export * from './FoodSimple';
|
||||
export * from './Group';
|
||||
export * from './ImportImage';
|
||||
export * from './ImportLog';
|
||||
export * from './Ingredient';
|
||||
export * from './IngredientString';
|
||||
|
||||
Reference in New Issue
Block a user