import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class OcrService { private apiUrl = 'http://localhost:8000/api/ocr'; constructor(private http: HttpClient) { } extractText(file: File): Observable { const formData = new FormData(); formData.append('file', file); return this.http.post(`${this.apiUrl}/extract`, formData); } extractWithAI(text: string, filePath: string | null, modelType: string): Observable { return this.http.post(`http://localhost:8000/api/extract/ai`, { text, file_path: filePath, model_type: modelType }); } saveDocument(data: any): Observable { return this.http.post(`http://localhost:8000/api/documents/save`, data); } }