ImageGenerate / app.py
Rakesh443's picture
Create app.py
6afe459 verified
raw
history blame
790 Bytes
import streamlit as st
import requests
import io
from PIL import Image
import os
# Create a text input
api_key = os.getenv("ImageGenerating")
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)
# st.image(image : image,caption=image)