Oviya
commited on
Commit
·
8e4fbd5
1
Parent(s):
43f0ed7
add listen
Browse files
src/app/listen/listen.service.ts
CHANGED
|
@@ -6,12 +6,15 @@ import { Observable } from 'rxjs';
|
|
| 6 |
providedIn: 'root'
|
| 7 |
})
|
| 8 |
export class ListenService {
|
| 9 |
-
private
|
|
|
|
|
|
|
|
|
|
| 10 |
constructor(private http: HttpClient) { }
|
| 11 |
|
| 12 |
// Fetch the list of available videos
|
| 13 |
getVideos(): Observable<any[]> {
|
| 14 |
-
return this.http.get<any[]>(`${this.
|
| 15 |
}
|
| 16 |
|
| 17 |
// Generate questions for a specific video
|
|
@@ -20,10 +23,10 @@ export class ListenService {
|
|
| 20 |
//}
|
| 21 |
|
| 22 |
uploadVideo(videoData: FormData): Observable<any> {
|
| 23 |
-
return this.http.post<any>(`${this.
|
| 24 |
}
|
| 25 |
|
| 26 |
generateQuestions(filename: string): Observable<any> {
|
| 27 |
-
return this.http.post<any>(`${this.
|
| 28 |
}
|
| 29 |
}
|
|
|
|
| 6 |
providedIn: 'root'
|
| 7 |
})
|
| 8 |
export class ListenService {
|
| 9 |
+
private readonly baseUrl = location.hostname.endsWith('hf.space')
|
| 10 |
+
? 'https://pykara-py-learn-backend.hf.space/media'
|
| 11 |
+
: 'http://localhost:5000/media';
|
| 12 |
+
|
| 13 |
constructor(private http: HttpClient) { }
|
| 14 |
|
| 15 |
// Fetch the list of available videos
|
| 16 |
getVideos(): Observable<any[]> {
|
| 17 |
+
return this.http.get<any[]>(`${this.baseUrl}/videos`);
|
| 18 |
}
|
| 19 |
|
| 20 |
// Generate questions for a specific video
|
|
|
|
| 23 |
//}
|
| 24 |
|
| 25 |
uploadVideo(videoData: FormData): Observable<any> {
|
| 26 |
+
return this.http.post<any>(`${this.baseUrl}/upload-video`, videoData);
|
| 27 |
}
|
| 28 |
|
| 29 |
generateQuestions(filename: string): Observable<any> {
|
| 30 |
+
return this.http.post<any>(`${this.baseUrl}/generate-questions-dynamicvideo`, { filename });
|
| 31 |
}
|
| 32 |
}
|