Skip to content

Commit

Permalink
com.rest.huggingface 1.0.0-preview.9 (#7)
Browse files Browse the repository at this point in the history
- added task cancellation support to binary inference task responses
- updated deps
  • Loading branch information
StephenHodgson authored Aug 12, 2023
1 parent 197a6ff commit 8f0bc4e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
12 changes: 11 additions & 1 deletion Runtime/Inference/Audio/TextToSpeech/TextToSpeechResponse.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.IO;
using System.Threading;
Expand Down Expand Up @@ -28,7 +30,15 @@ public override async Task DecodeAsync(Stream stream, CancellationToken cancella
}
catch (Exception e)
{
Debug.LogError(e);
switch (e)
{
case TaskCanceledException:
case OperationCanceledException:
throw;
default:
Debug.LogError(e);
break;
}
}
finally
{
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Inference/BinaryInferenceTaskResponse.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.IO;
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ public override async Task DecodeAsync(Stream stream, CancellationToken cancella
}
catch (Exception e)
{
Debug.LogError(e);
switch (e)
{
case TaskCanceledException:
case OperationCanceledException:
throw;
default:
Debug.LogError(e);
break;
}
}
finally
{
Expand Down
12 changes: 11 additions & 1 deletion Runtime/Inference/Multimodal/TextToImage/TextToImageResponse.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.IO;
using System.Threading;
Expand Down Expand Up @@ -28,7 +30,15 @@ public override async Task DecodeAsync(Stream stream, CancellationToken cancella
}
catch (Exception e)
{
Debug.LogError(e);
switch (e)
{
case TaskCanceledException:
case OperationCanceledException:
throw;
default:
Debug.LogError(e);
break;
}
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "HuggingFace",
"description": "A Non-Official HuggingFace Rest Client for Unity (UPM)",
"keywords": [],
"version": "1.0.0-preview.8",
"version": "1.0.0-preview.9",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.rest.huggingface#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.rest.huggingface/releases",
Expand All @@ -20,7 +20,7 @@
"registry": "https://package.openupm.com"
},
"dependencies": {
"com.utilities.rest": "2.0.7",
"com.utilities.rest": "2.1.3",
"com.utilities.encoder.wav": "1.0.4"
},
"hideInEditor": false
Expand Down

0 comments on commit 8f0bc4e

Please sign in to comment.