@@ -15,7 +15,7 @@ import (
15
15
func RegisterEndpoints (base string , mux * http.ServeMux , whisper * whisper.Whisper ) {
16
16
// Health: GET /v1/health
17
17
// returns an empty OK response
18
- mux .HandleFunc (joinPath (base , "health" ), wrapLogging ( func (w http.ResponseWriter , r * http.Request ) {
18
+ mux .HandleFunc (joinPath (base , "health" ), func (w http.ResponseWriter , r * http.Request ) {
19
19
defer r .Body .Close ()
20
20
21
21
switch r .Method {
@@ -24,14 +24,14 @@ func RegisterEndpoints(base string, mux *http.ServeMux, whisper *whisper.Whisper
24
24
default :
25
25
httpresponse .Error (w , http .StatusMethodNotAllowed )
26
26
}
27
- }))
27
+ })
28
28
29
29
// List Models: GET /v1/models
30
30
// returns available models
31
31
// Download Model: POST /v1/models?stream={bool}
32
32
// downloads a model from the server
33
33
// if stream is true then progress is streamed back to the client
34
- mux .HandleFunc (joinPath (base , "models" ), wrapLogging ( func (w http.ResponseWriter , r * http.Request ) {
34
+ mux .HandleFunc (joinPath (base , "models" ), func (w http.ResponseWriter , r * http.Request ) {
35
35
defer r .Body .Close ()
36
36
37
37
switch r .Method {
@@ -42,13 +42,13 @@ func RegisterEndpoints(base string, mux *http.ServeMux, whisper *whisper.Whisper
42
42
default :
43
43
httpresponse .Error (w , http .StatusMethodNotAllowed )
44
44
}
45
- }))
45
+ })
46
46
47
47
// Get: GET /v1/models/{id}
48
48
// returns an existing model
49
49
// Delete: DELETE /v1/models/{id}
50
50
// deletes an existing model
51
- mux .HandleFunc (joinPath (base , "models/{id}" ), wrapLogging ( func (w http.ResponseWriter , r * http.Request ) {
51
+ mux .HandleFunc (joinPath (base , "models/{id}" ), func (w http.ResponseWriter , r * http.Request ) {
52
52
defer r .Body .Close ()
53
53
54
54
id := r .PathValue ("id" )
@@ -60,12 +60,12 @@ func RegisterEndpoints(base string, mux *http.ServeMux, whisper *whisper.Whisper
60
60
default :
61
61
httpresponse .Error (w , http .StatusMethodNotAllowed )
62
62
}
63
- }))
63
+ })
64
64
65
65
// Translate: POST /v1/audio/translations
66
66
// Translates audio into english or another language - language parameter should be set to the
67
67
// destination language of the audio. Will default to english if not set.
68
- mux .HandleFunc (joinPath (base , "audio/translations" ), wrapLogging ( func (w http.ResponseWriter , r * http.Request ) {
68
+ mux .HandleFunc (joinPath (base , "audio/translations" ), func (w http.ResponseWriter , r * http.Request ) {
69
69
defer r .Body .Close ()
70
70
71
71
switch r .Method {
@@ -74,12 +74,12 @@ func RegisterEndpoints(base string, mux *http.ServeMux, whisper *whisper.Whisper
74
74
default :
75
75
httpresponse .Error (w , http .StatusMethodNotAllowed )
76
76
}
77
- }))
77
+ })
78
78
79
79
// Transcribe: POST /v1/audio/transcriptions
80
80
// Transcribes audio into the input language - language parameter should be set to the source
81
81
// language of the audio
82
- mux .HandleFunc (joinPath (base , "audio/transcriptions" ), wrapLogging ( func (w http.ResponseWriter , r * http.Request ) {
82
+ mux .HandleFunc (joinPath (base , "audio/transcriptions" ), func (w http.ResponseWriter , r * http.Request ) {
83
83
defer r .Body .Close ()
84
84
85
85
switch r .Method {
@@ -102,21 +102,22 @@ func RegisterEndpoints(base string, mux *http.ServeMux, whisper *whisper.Whisper
102
102
default :
103
103
httpresponse .Error (w , http .StatusMethodNotAllowed )
104
104
}
105
- }))
105
+ })
106
106
107
107
// Transcribe: POST /v1/audio/transcriptions/{model-id}
108
108
// Transcribes streamed media into the input language
109
- mux .HandleFunc (joinPath (base , "audio/transcriptions/{model}" ), wrapLogging (func (w http.ResponseWriter , r * http.Request ) {
110
- defer r .Body .Close ()
111
-
112
- model := r .PathValue ("model" )
113
- switch r .Method {
114
- case http .MethodPost :
115
- TranscribeStream (r .Context (), whisper , w , r , model )
116
- default :
117
- httpresponse .Error (w , http .StatusMethodNotAllowed )
118
- }
119
- }))
109
+ /*
110
+ mux.HandleFunc(joinPath(base, "audio/transcriptions/{model}"), func(w http.ResponseWriter, r *http.Request) {
111
+ defer r.Body.Close()
112
+
113
+ model := r.PathValue("model")
114
+ switch r.Method {
115
+ case http.MethodPost:
116
+ TranscribeStream(r.Context(), whisper, w, r, model)
117
+ default:
118
+ httpresponse.Error(w, http.StatusMethodNotAllowed)
119
+ }
120
+ })*/
120
121
}
121
122
122
123
/////////////////////////////////////////////////////////////////////////////
0 commit comments