Download src/app/api.service.ts from pykara/py-match: direct link, hf CLI and curl.
- Browser
- Download file 852 Bytes
-
https://huggingface.co/spaces/pykara/py-match/resolve/main/src/app/api.service.ts
- Command line
-
hf download hf://spaces/pykara/py-match/src/app/api.service.ts
-
curl -L -o api.service.ts https://huggingface.co/spaces/pykara/py-match/resolve/main/src/app/api.service.ts
852 Bytes
| import { Injectable } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { environment } from '../environments/environment'; | |
| ({ providedIn: 'root' }) | |
| export class ApiService { | |
| // Decide backend base URL at runtime | |
| private readonly base = location.hostname.endsWith('hf.space') | |
| ? 'https://pykara-py-match-backend.hf.space' | |
| : 'http://localhost:5000'; // Local Flask backend | |
| //private base = environment.apiBase; | |
| constructor(private http: HttpClient) { } | |
| start(body = { n_questions: 10, batch_size: 5, domain: 'marriage' }) { | |
| return this.http.post<any>(`${this.base}/q/start`, body); | |
| } | |
| next(session_id: string, selected_color: 'blue' | 'green' | 'red' | 'yellow') { | |
| return this.http.post<any>(`${this.base}/q/next`, { session_id, selected_color }); | |
| } | |
| } | |