ImageGenerate / app.py
Rakesh443's picture
Update app.py
df059ae verified
raw
history blame contribute delete
951 Bytes
import streamlit as st
import requests
import io
from PIL import Image
import os
# Create a text input
API_KEY = os.environ.get("API_KEY")
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
headers = {"Authorization": f"Bearer {API_KEY}"}
user_input = st.text_input("Enter your text here:")
# Process the input (you can replace this with your own logic)
processed_output = user_input.upper()
# Display the processed output
# st.write(f"Processed output: {processed_output}")
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
image_bytes = query({
"inputs": user_input,
})
image = Image.open(io.BytesIO(image_bytes))
st.image(image, caption="image", width=None, use_column_width=None, clamp=False, channels="RGB", output_format="auto")
# st.image(image=image,caption="image")
# st.image(image)
# st.image(image : image,caption=image)