homegrownherbalist commited on
Commit
4b2fd42
·
verified ·
1 Parent(s): 48dab6f

Delete Test.ps1

Browse files
Files changed (1) hide show
  1. Test.ps1 +0 -50
Test.ps1 DELETED
@@ -1,50 +0,0 @@
1
- $ErrorActionPreference = "Stop";
2
-
3
- # Send the POST request with the form data
4
- $Uri = "http://localhost:8080/v1/audio/transcriptions"
5
-
6
- function MultiPart($data){
7
- $FormBoundary = [System.Guid]::NewGuid().ToString();
8
- $BodyLines = @()
9
-
10
- $Fields = @($data.keys)
11
-
12
- foreach($FieldName in $Fields){
13
- $FieldValue = $data[$FieldName];
14
- $BodyLines += "--$FormBoundary"
15
-
16
- if($FieldValue -is [IO.FileInfo]){
17
-
18
- $File = $FieldValue
19
- $BodyLines += "Content-Disposition: form-data; name=`"$FieldName`"; filename=`"$($File.name)`""
20
- $BodyLines += "Content-Type: application/octet-stream"
21
- $FileBytes = [System.IO.File]::ReadAllBytes($File.FullName);
22
- $FieldValue = [System.Text.Encoding]::GetEncoding("iso-8859-1").GetString($FileBytes)
23
- } else {
24
- $BodyLines += "Content-Disposition: form-data; name=`"$FieldName`""
25
- }
26
-
27
- $BodyLines += ""
28
- $BodyLines += $FieldValue
29
- }
30
-
31
-
32
- $BodyLines += "--$FormBoundary--"
33
-
34
- $BodyFinal = $BodyLines -Join "`r`n"
35
-
36
- Invoke-WebRequest @Args -method POST -body $BodyFinal -ContentType "multipart/form-data; boundary=$FormBoundary"
37
- }
38
-
39
- # Create the form data payload
40
- $FormData = @{
41
- "file" = (Get-Item .\SampleSmall.wav)
42
- model = "Systran/faster-whisper-small"
43
- }
44
-
45
-
46
- $RawResp = MultiPart $FormData -Uri $Uri
47
- $result = [System.Text.Encoding]::UTF8.GetString($RawResp.RawContentStream.ToArray())
48
-
49
- # Output the response from the server
50
- $result