Spaces:
Build error
Build error
Download test.py from smdbs/CS553_CaseStudy1: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/smdbs/CS553_CaseStudy1/resolve/main/test.py
- Command line
-
hf download hf://spaces/smdbs/CS553_CaseStudy1/test.py
-
curl -L -o test.py https://huggingface.co/spaces/smdbs/CS553_CaseStudy1/resolve/main/test.py
1.11 kB
| import unittest | |
| import os | |
| from app import sd_2_1_base | |
| HF_TOKEN = os.environ.get("HF_TOKEN", "YOUR_HF_TOKEN") | |
| TOKEN_MSG = "Set HF_TOKEN to your Hugging Face token for using InferenceClient" | |
| SKIP_MSG = "Skipping test because HF_TOKEN is not set" | |
| class TestGeneralSetup(unittest.TestCase): | |
| def test_setup(self): | |
| self.assertTrue(HF_TOKEN != "YOUR_HF_TOKEN", TOKEN_MSG) | |
| # class TestLocalModel(unittest.TestCase): | |
| # @unittest.skipIf(HF_TOKEN == "YOUR_HF_TOKEN", SKIP_MSG) | |
| # # @unittest.skipIf(not torch.cuda.is_available(), "CUDA is not available") | |
| # def test_url_1(self): | |
| # image, _ = sd_2_1_base( | |
| # "A photo of a cat", True, "A photo of a dog", 42, False, 0.1, 10, 128, 128 | |
| # ) | |
| # self.assertIsNotNone(image) | |
| class TestAPIModel(unittest.TestCase): | |
| def test_url_1(self): | |
| image, _ = sd_2_1_base( | |
| "A photo of a cat", False, "A photo of a dog", 42, False, 0.1, 10, 128, 128 | |
| ) | |
| self.assertIsNotNone(image) | |
| if __name__ == "__main__": | |
| unittest.main() | |