Skip to content

Commit

Permalink
Used better object detection test image. Fixed issue where err of Mak…
Browse files Browse the repository at this point in the history
…eHFAPIRequestWithMedia err was not checked
  • Loading branch information
Tanner Kvarfordt authored and Tanner Kvarfordt committed Nov 23, 2021
1 parent dab3c02 commit 9569024
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions audio_classification.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ type AudioClassificationResponse struct {

func SendAudioClassificationRequest(model, audioFile string) ([]*AudioClassificationResponse, error) {
respBody, err := MakeHFAPIRequestWithMedia(model, audioFile)
if err != nil {
return nil, err
}

acresp := []*AudioClassificationResponse{}
err = json.Unmarshal(respBody, &acresp)
Expand Down
3 changes: 3 additions & 0 deletions object_detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type ObjectBox struct {

func SendObjectDetectionRequest(model, imageFile string) ([]*ObjectDetectionResponse, error) {
respBody, err := MakeHFAPIRequestWithMedia(model, imageFile)
if err != nil {
return nil, err
}

resps := []*ObjectDetectionResponse{}
err = json.Unmarshal(respBody, &resps)
Expand Down
3 changes: 3 additions & 0 deletions speech_recognition.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type SpeechRecognitionResponse struct {
// It reads the file and sends a request to the speech recognition endpoint.
func SendSpeechRecognitionRequest(model, audioFile string) (*SpeechRecognitionResponse, error) {
respBody, err := MakeHFAPIRequestWithMedia(model, audioFile)
if err != nil {
return nil, err
}

arresp := SpeechRecognitionResponse{}
err = json.Unmarshal(respBody, &arresp)
Expand Down
Binary file modified test_files/test-image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9569024

Please sign in to comment.