Download tests/test_free_models.py from tokgae/cora: direct link, hf CLI and curl.
- Browser
- Download file 961 Bytes
-
https://huggingface.co/spaces/tokgae/cora/resolve/main/tests/test_free_models.py
- Command line
-
hf download hf://spaces/tokgae/cora/tests/test_free_models.py
-
curl -L -o test_free_models.py https://huggingface.co/spaces/tokgae/cora/resolve/main/tests/test_free_models.py
961 Bytes
| from huggingface_hub import InferenceClient | |
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv() | |
| token = os.getenv("HF_API_TOKEN") | |
| prompt = "A roman mercenary" | |
| candidates = [ | |
| "stabilityai/stable-diffusion-2-1", | |
| "runwayml/stable-diffusion-v1-5", | |
| "prompthero/openjourney", | |
| "CompVis/stable-diffusion-v1-4", | |
| "Segmind/SSD-1B" | |
| ] | |
| print("--- Searching for Free Models ---") | |
| for model in candidates: | |
| print(f"\nTesting: {model}...") | |
| client = InferenceClient(model=model, token=token) | |
| try: | |
| # Standard conservative params | |
| image = client.text_to_image(prompt, guidance_scale=7.5) | |
| fname = f"test_{model.replace('/', '_')}.png" | |
| image.save(fname) | |
| print(f"✅ SUCCESS! {model} is FREE and working.") | |
| # Stop after first success to save time/credits? | |
| # No, let's find the best one. | |
| except Exception as e: | |
| print(f"❌ FAILED: {model} - {e}") | |