CoolFace
Apppublic

smdbs/CS553_CaseStudy1

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
test.py37 linesDownload Raw Back to root
1import unittest2import os3 4from app import sd_2_1_base5 6HF_TOKEN = os.environ.get("HF_TOKEN", "YOUR_HF_TOKEN")7TOKEN_MSG = "Set HF_TOKEN to your Hugging Face token for using InferenceClient"8SKIP_MSG = "Skipping test because HF_TOKEN is not set"9 10 11class TestGeneralSetup(unittest.TestCase):12    def test_setup(self):13        self.assertTrue(HF_TOKEN != "YOUR_HF_TOKEN", TOKEN_MSG)14 15 16# class TestLocalModel(unittest.TestCase):17#     @unittest.skipIf(HF_TOKEN == "YOUR_HF_TOKEN", SKIP_MSG)18#     # @unittest.skipIf(not torch.cuda.is_available(), "CUDA is not available")19#     def test_url_1(self):20#         image, _ = sd_2_1_base(21#             "A photo of a cat", True, "A photo of a dog", 42, False, 0.1, 10, 128, 12822#         )23#         self.assertIsNotNone(image)24 25 26class TestAPIModel(unittest.TestCase):27    @unittest.skipIf(HF_TOKEN == "YOUR_HF_TOKEN", SKIP_MSG)28    def test_url_1(self):29        image, _ = sd_2_1_base(30            "A photo of a cat", False, "A photo of a dog", 42, False, 0.1, 10, 128, 12831        )32        self.assertIsNotNone(image)33 34 35if __name__ == "__main__":36    unittest.main()37