Skip to content

Commit a3d6833

Browse files
authored
Merge pull request #48 from mutablelogic/v1
V1
2 parents 352926b + a27efed commit a3d6833

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ available at `http://localhost:8080/v1` and it generally conforms to the
3838
In order to download a model, you can use the following command (for example):
3939

4040
```bash
41-
curl -X POST -H "Content-Type: application/json" -d '{"Path" : "ggml-medium-q5_0.bin" }' localhost:8080/v1/models
41+
curl -X POST -H "Content-Type: application/json" -d '{"Path" : "ggml-medium-q5_0.bin" }' localhost:8080/v1/models\?stream=true
4242
```
4343

4444
To list the models available, you can use the following command:
@@ -56,13 +56,13 @@ curl -X DELETE localhost:8080/v1/models/ggml-medium-q5_0
5656
To transcribe a media file into it's original language, you can use the following command:
5757

5858
```bash
59-
curl -F model=ggml-medium-q5_0 -F file=@samples/jfk.wav localhost:8080/v1/audio/transcriptions
59+
curl -F model=ggml-medium-q5_0 -F file=@samples/jfk.wav localhost:8080/v1/audio/transcriptions\?stream=true
6060
```
6161

6262
To translate a media file into a different language, you can use the following command:
6363

6464
```bash
65-
curl -F model=ggml-medium-q5_0 -F file=@samples/de-podcast.wav -F language=en localhost:8080/v1/audio/transcriptions\?stream=true
65+
curl -F model=ggml-medium-q5_0 -F file=@samples/ge-podcast.wav -F language=en localhost:8080/v1/audio/translations\?stream=true
6666
```
6767

6868
There's more information on the API [here](doc/API.md).

doc/API.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ Downloads a model from remote huggingface repository. If the optional `stream` a
5959
the progress is streamed back to the client as a series of [text/event-stream](https://html.spec.whatwg.org/multipage/server-sent-events.html) events.
6060

6161
If the model is already downloaded, a 200 OK status is returned. If the model was downloaded, a 201 Created status is returned.
62+
Example streaming response:
63+
64+
```text
65+
event: ping
66+
67+
event: progress
68+
data: {"status":"downloading ggml-medium-q5_0.bin","total":539212467,"completed":10159256}
69+
70+
event: progress
71+
data: {"status":"downloading ggml-medium-q5_0.bin","total":539212467,"completed":21895036}
72+
73+
event: progress
74+
data: {"status":"downloading ggml-medium-q5_0.bin","total":539212467,"completed":33540592}
75+
76+
event: ok
77+
data: {"id":"ggml-medium-q5_0","object":"model","path":"ggml-medium-q5_0.bin","created":1722411778}
78+
```
79+
6280

6381
### Delete Model
6482

@@ -102,6 +120,28 @@ Transcribes audio into the input language.
102120

103121
If the optional `stream` argument is true, the segments of the transcription are returned as a series of [text/event-stream](https://html.spec.whatwg.org/multipage/server-sent-events.html) events. Otherwise, the full transcription is returned in the response body.
104122

123+
Example streaming response:
124+
125+
```text
126+
event: ping
127+
128+
event: task
129+
data: {"task":"translate","language":"en","duration":62.6155}
130+
131+
event: ping
132+
133+
event: segment
134+
data: {"id":0,"start":0,"end":14.2,"text":" What do you think about new media like Facebook, emails and cell phones?"}
135+
136+
event: segment
137+
data: {"id":1,"start":14.2,"end":18.2,"text":" The new media make our life much easier."}
138+
139+
event: segment
140+
data: {"id":2,"start":18.2,"end":23,"text":" You can get in touch with people much faster than before."}
141+
142+
event: ok
143+
```
144+
105145
### Translation
106146

107147
This is the same as transcription (above) except that the `language` parameter is not optional, and should be the language to translate the audio into.

0 commit comments

Comments
 (0)