diff --git a/audio_classification_test.go b/audio_classification_test.go index b70d48e..3f208b2 100644 --- a/audio_classification_test.go +++ b/audio_classification_test.go @@ -2,24 +2,14 @@ package hfapigo_test import ( "testing" - "time" "github.com/Kardbord/hfapigo/v3" ) func TestAudioClassificationRequest(t *testing.T) { - const retries = 10 - acResps := []*hfapigo.AudioClassificationResponse{} var err error - for i := 0; i < retries; i++ { - acResps, err = hfapigo.SendAudioClassificationRequest(hfapigo.RecommendedAudioClassificationModel, TestFilesDir+"/sample.flac") - if err == nil { - break - } else { - time.Sleep(time.Second * 5) - } - } + acResps, err = hfapigo.SendAudioClassificationRequest(hfapigo.RecommendedAudioClassificationModel, TestFilesDir+"/sample.flac") if err != nil { t.Fatal(err) } diff --git a/image_to_text_test.go b/image_to_text_test.go index 8c76e98..1294777 100644 --- a/image_to_text_test.go +++ b/image_to_text_test.go @@ -2,25 +2,15 @@ package hfapigo_test import ( "testing" - "time" "github.com/Kardbord/hfapigo/v3" ) func TestImageToText(t *testing.T) { - const retries = 10 resps := []*hfapigo.ImageToTextResponse{} var err error - for i := 0; i < retries; i++ { - resps, err = hfapigo.SendImageToTextRequest(hfapigo.RecommendedImageToTextModel, TestFilesDir+"/test-image.png") - if err == nil { - break - } else { - time.Sleep(time.Second * 5) - } - } - + resps, err = hfapigo.SendImageToTextRequest(hfapigo.RecommendedImageToTextModel, TestFilesDir+"/test-image.png") if err != nil { t.Fatal(err) } diff --git a/object_detection_test.go b/object_detection_test.go index f484858..70e31f9 100644 --- a/object_detection_test.go +++ b/object_detection_test.go @@ -2,24 +2,14 @@ package hfapigo_test import ( "testing" - "time" "github.com/Kardbord/hfapigo/v3" ) func TestObjectDetectionRequest(t *testing.T) { - const retries = 10 - resps := []*hfapigo.ObjectDetectionResponse{} var err error - for i := 0; i < retries; i++ { - resps, err = hfapigo.SendObjectDetectionRequest(hfapigo.RecommendedObjectDetectionModel, TestFilesDir+"/test-image.png") - if err == nil { - break - } else { - time.Sleep(time.Second * 5) - } - } + resps, err = hfapigo.SendObjectDetectionRequest(hfapigo.RecommendedObjectDetectionModel, TestFilesDir+"/test-image.png") if err != nil { t.Fatal(err) } diff --git a/setup_test.go b/setup_test.go index 28b7d96..657d5cb 100644 --- a/setup_test.go +++ b/setup_test.go @@ -20,12 +20,9 @@ func init() { } func TestMain(m *testing.M) { - shouldWarn := hfapigo.APIKey() == "" - if shouldWarn { - fmt.Printf("%s not found in env, tests may fail due to rate limiting.\n", HuggingFaceTokenEnv) + if hfapigo.APIKey() == "" { + fmt.Fprintf(os.Stderr, "%s not set, tests will fail due to rate limiting.", HuggingFaceTokenEnv) + os.Exit(1) } m.Run() - if shouldWarn { - fmt.Printf("%s not found in env, tests may fail due to rate limiting.\n", HuggingFaceTokenEnv) - } } diff --git a/speech_recognition_test.go b/speech_recognition_test.go index 712726f..ab80094 100644 --- a/speech_recognition_test.go +++ b/speech_recognition_test.go @@ -2,24 +2,14 @@ package hfapigo_test import ( "testing" - "time" "github.com/Kardbord/hfapigo/v3" ) func TestSpeechRecognitionRequest(t *testing.T) { - const retries = 10 - arResp := &hfapigo.SpeechRecognitionResponse{} var err error - for i := 0; i < retries; i++ { - arResp, err = hfapigo.SendSpeechRecognitionRequest(hfapigo.RecommendedSpeechRecongnitionModelEnglish, TestFilesDir+"/sample.flac") - if err == nil { - break - } else { - time.Sleep(time.Second * 5) - } - } + arResp, err = hfapigo.SendSpeechRecognitionRequest(hfapigo.RecommendedSpeechRecongnitionModelEnglish, TestFilesDir+"/sample.flac") if err != nil { t.Fatal(err) } diff --git a/text_to_image.go b/text_to_image.go index 51f0780..cf7a2c7 100644 --- a/text_to_image.go +++ b/text_to_image.go @@ -10,7 +10,7 @@ import ( _ "image/png" ) -const RecommendedTextToImageModel = "runwayml/stable-diffusion-v1-5" +const RecommendedTextToImageModel = "stable-diffusion-v1-5/stable-diffusion-v1-5" // Request structure for text-to-image model type TextToImageRequest struct {