mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
feat: Remove OCR Support (#2838)
* remove ocr package * remove tesseract * remove OCR from app * remove OCR from tests * fix docs
This commit is contained in:
parent
c48680374d
commit
ca9f66ee24
34 changed files with 29 additions and 1570 deletions
|
@ -23,7 +23,6 @@ import { MultiPurposeLabelsApi } from "./user/group-multiple-purpose-labels";
|
|||
import { GroupEventNotifierApi } from "./user/group-event-notifier";
|
||||
import { MealPlanRulesApi } from "./user/group-mealplan-rules";
|
||||
import { GroupDataSeederApi } from "./user/group-seeder";
|
||||
import { OcrAPI } from "./user/ocr";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
|
||||
export class UserApiClient {
|
||||
|
@ -52,7 +51,6 @@ export class UserApiClient {
|
|||
public groupEventNotifier: GroupEventNotifierApi;
|
||||
public upload: UploadFile;
|
||||
public seeders: GroupDataSeederApi;
|
||||
public ocr: OcrAPI;
|
||||
|
||||
constructor(requests: ApiRequestInstance) {
|
||||
// Recipes
|
||||
|
@ -91,9 +89,6 @@ export class UserApiClient {
|
|||
this.bulk = new BulkActionsAPI(requests);
|
||||
this.groupEventNotifier = new GroupEventNotifierApi(requests);
|
||||
|
||||
// ocr
|
||||
this.ocr = new OcrAPI(requests);
|
||||
|
||||
Object.freeze(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
/* This file was automatically generated from pydantic models by running pydantic2ts.
|
||||
/* Do not modify it by hand - just update the pydantic models and then re-run the script
|
||||
*/
|
||||
|
||||
export interface OcrAssetReq {
|
||||
recipeSlug: string;
|
||||
assetName: string;
|
||||
}
|
||||
export interface OcrTsvResponse {
|
||||
level?: number;
|
||||
pageNum?: number;
|
||||
blockNum?: number;
|
||||
parNum?: number;
|
||||
lineNum?: number;
|
||||
wordNum?: number;
|
||||
left?: number;
|
||||
top?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
conf?: number;
|
||||
text?: string;
|
||||
}
|
|
@ -244,7 +244,6 @@ export interface Recipe {
|
|||
extras?: {
|
||||
[k: string]: unknown;
|
||||
};
|
||||
isOcrRecipe?: boolean;
|
||||
comments?: RecipeCommentOut[];
|
||||
}
|
||||
export interface RecipeTool {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
export class OcrAPI extends BaseAPI {
|
||||
// Currently unused in favor for the endpoint using asset names
|
||||
async fileToTsv(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return await this.requests.post(`${prefix}/ocr/file-to-tsv`, formData);
|
||||
}
|
||||
|
||||
async assetToTsv(recipeSlug: string, assetName: string) {
|
||||
return await this.requests.post(`${prefix}/ocr/asset-to-tsv`, { recipeSlug, assetName });
|
||||
}
|
||||
}
|
|
@ -38,7 +38,6 @@ const routes = {
|
|||
recipesCategory: `${prefix}/recipes/category`,
|
||||
recipesParseIngredient: `${prefix}/parser/ingredient`,
|
||||
recipesParseIngredients: `${prefix}/parser/ingredients`,
|
||||
recipesCreateFromOcr: `${prefix}/recipes/create-ocr`,
|
||||
recipesTimelineEvent: `${prefix}/recipes/timeline/events`,
|
||||
|
||||
recipesRecipeSlug: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}`,
|
||||
|
@ -159,15 +158,6 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
return `${routes.recipesRecipeSlugExportZip(recipeSlug)}?token=${token}`;
|
||||
}
|
||||
|
||||
async createFromOcr(file: File, makeFileRecipeImage: boolean) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("extension", file.name.split(".").pop() ?? "");
|
||||
formData.append("makefilerecipeimage", String(makeFileRecipeImage));
|
||||
|
||||
return await this.requests.post(routes.recipesCreateFromOcr, formData);
|
||||
}
|
||||
|
||||
async updateLastMade(recipeSlug: string, timestamp: string) {
|
||||
return await this.requests.patch<Recipe, RecipeLastMade>(routes.recipesSlugLastMade(recipeSlug), { timestamp })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue