Skip to content

Commit

Permalink
Change over "speech" to "audio".
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Oct 14, 2024
1 parent ed23a0c commit 960888d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
4 changes: 0 additions & 4 deletions AiServer.ServiceInterface/Jobs/CreateGenerationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ private async Task HandleFileUploadsTask(BackgroundJob job, GenerationArgs argIn
case "mask":
argInstance.MaskInput = ms;
break;
case "speech":
argInstance.SpeechInput = ms;
break;
case "audio":
argInstance.AudioInput = ms;
break;
Expand All @@ -113,7 +110,6 @@ private async Task HandleFileUploadsTask(BackgroundJob job, GenerationArgs argIn
{
"image",
"mask",
"speech",
"audio"
};

Expand Down
2 changes: 1 addition & 1 deletion AiServer.ServiceInterface/MediaProviderServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private string GetFileExtension(string contentType)
};
}

private static string[] supportedUploadNames = ["speech", "audio", "image", "mask"];
private static string[] supportedUploadNames = ["audio", "image", "mask"];

public object Any(QueryMediaModels request)
{
Expand Down
8 changes: 4 additions & 4 deletions AiServer.ServiceInterface/SpeechServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<object> Any(QueueSpeechToText request)
if(Request?.Files == null || Request.Files.Length == 0)
{
log.LogError("No files attached to request");
throw new ArgumentNullException(nameof(request.Speech));
throw new ArgumentNullException(nameof(request.Audio));
}

var diffRequest = new CreateGeneration
Expand All @@ -50,7 +50,7 @@ public async Task<object> Any(QueueSpeechToText request)
{
Model = "speech-to-text",
TaskType = AiTaskType.SpeechToText,
SpeechInput = request.Speech
SpeechInput = request.Audio
}
};

Expand Down Expand Up @@ -81,7 +81,7 @@ public async Task<object> Any(SpeechToText request)
if(Request?.Files == null || Request.Files.Length == 0)
{
log.LogError("No files attached to request");
throw new ArgumentNullException(nameof(request.Speech));
throw new ArgumentNullException(nameof(request.Audio));
}

var diffRequest = new CreateGeneration
Expand All @@ -90,7 +90,7 @@ public async Task<object> Any(SpeechToText request)
{
Model = "speech-to-text",
TaskType = AiTaskType.SpeechToText,
SpeechInput = request.Speech
SpeechInput = request.Audio
}
};

Expand Down
2 changes: 1 addition & 1 deletion AiServer.ServiceModel/Generations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SpeechToText : IGeneration, IReturn<GenerationResponse>
[Description("The audio stream containing the speech to be transcribed")]
[Required]
[Input(Type = "file")]
public Stream Speech { get; set; }
public Stream Audio { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
Expand Down
2 changes: 1 addition & 1 deletion AiServer.ServiceModel/QueueGenerations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class QueueSpeechToText : IQueueGeneration, IReturn<QueueGenerationRespon
[Description("The audio stream containing the speech to be transcribed")]
[Required]
[Input(Type = "file")]
public Stream Speech { get; set; }
public Stream Audio { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
Expand Down
6 changes: 3 additions & 3 deletions AiServer.Tests/QueueSpeechToTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task Can_queue_transcribe_speech()
response = client.PostFilesWithRequest<QueueGenerationResponse>(new QueueSpeechToText
{

}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "speech"} });
}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "audio"} });
}
catch (Exception e)
{
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task Can_transcribe_speech_with_reply_to()
response = client.PostFilesWithRequest<QueueGenerationResponse>(new QueueSpeechToText
{
ReplyTo = "https://localhost:5005/dummyreplyto"
}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "speech"} });
}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "audio"} });
}
catch (Exception e)
{
Expand Down Expand Up @@ -131,7 +131,7 @@ public async Task Can_transcribe_speech_without_sync_or_reply_to()
response = client.PostFilesWithRequest<QueueGenerationResponse>(new QueueSpeechToText
{

}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "speech"} });
}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "audio"} });
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion AiServer.Tests/SpeechToTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task Can_transcribe_speech()
response = client.PostFilesWithRequest<GenerationResponse>(new SpeechToText
{

}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "speech"} });
}, new []{ new UploadFile("speech.wav", fileStream) { FieldName = "audio"} });
}
catch (Exception e)
{
Expand Down

0 comments on commit 960888d

Please sign in to comment.