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}")