| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { Injectable } from '@angular/core';
- import { HttpClient } from '@angular/common/http';
- import { Observable } from 'rxjs';
- @Injectable({
- providedIn: 'root'
- })
- export class ApiService {
- private apiUrl = 'http://localhost:3000';
- constructor(private http: HttpClient) { }
- getConfidence(): Observable<any> {
- return this.http.get(`${this.apiUrl}/get_confidence`);
- }
- setConfidence(threshold: number): Observable<any> {
- return this.http.post(`${this.apiUrl}/set_confidence`, { threshold });
- }
- analyze(file: File, modelType: string = 'onnx'): Observable<any> {
- const formData = new FormData();
- formData.append('file', file);
- formData.append('model_type', modelType);
- return this.http.post(`${this.apiUrl}/analyze`, formData);
- }
- getHistory(): Observable<any> {
- return this.http.get(`${this.apiUrl}/get_history`);
- }
- getModelInfo(modelType: string = 'onnx'): Observable<any> {
- return this.http.get(`${this.apiUrl}/get_model_info`, { params: { model_type: modelType } });
- }
- getAnalytics(): Observable<any> {
- // This could be used for a dashboard later
- return this.http.get(`${this.apiUrl}/get_history`);
- }
- }
|