Spaces:
Running
Running
File size: 765 Bytes
ce57cbe a1908e2 ce57cbe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import requests
import io
from PIL import Image
import os
headers = {"Authorization": f"Bearer {os.getenv('ImagiGen_HF_secret')}"}
def query(API_URL, payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
def flux(prompt):
image = ""
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
image_bytes = query(
API_URL,
{
"inputs": prompt,
},
)
return image_bytes
def stable_diffusion(prompt):
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3-medium-diffusers"
image_bytes = query(
API_URL,
{
"inputs": prompt,
},
)
return image_bytes
|