Spaces:
Sleeping
Sleeping
File size: 765 Bytes
233dcde e54a0d5 e6b153f 40041d3 e6b153f 40041d3 e6b153f 40041d3 233dcde 40041d3 233dcde 40041d3 |
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 |
# Python
import streamlit as st
import torch
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
import requests
import io
from PIL import Image
import os
from dotenv import load_dotenv
load_dotenv()
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-cascade-prior"
headers = {"Authorization": f"Bearer ${os.getenv('bearer_token')}"}
st.title("Image Generator with Diffusers")
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
prompt = st.text_input("Enter a prompt:", "batman hitting the griddy in gotham")
image_bytes = query({
"inputs": prompt,
})
# You can access the image with PIL.Image for example
image = Image.open(io.BytesIO(image_bytes)) |