EAM-style / app.py
maialumiaho's picture
Update app.py
cc4f9e4 verified
raw
history blame
511 Bytes
import streamlit as st
from PIL import Image
#authorization
API_URL = "https://api-inference.huggingface.co/models/xinsir/controlnet-union-sdxl-1.0"
headers = {"Authorization": "spaces_prototype"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
#function to generate image based on the prompt
def generate_image(prompt):
image_bytes = query({"inputs": prompt})
image = Image.open(io.BytesIO(image_bytes))
return image