|
|
|
|
|
import streamlit as st |
|
import requests |
|
import io |
|
from PIL import Image |
|
import os |
|
|
|
|
|
|
|
|
|
API_KEY = os.environ.get("API_KEY2") |
|
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5" |
|
headers = {"Authorization": f"Bearer {API_KEY}"} |
|
|
|
user_input = st.text_input("Enter your text here:") |
|
|
|
|
|
processed_output = user_input.upper() |
|
|
|
|
|
|
|
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") |
|
|
|
|
|
|