File size: 740 Bytes
f86b2f2
 
 
 
 
 
5b6119d
366e9da
1dfe549
f86b2f2
 
 
 
 
 
 
 
 
c1d35d2
f86b2f2
 
 
 
c1d35d2
a483ba9
f86b2f2
 
 
 
 
 
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
28
29
30
31
32
import streamlit as st
import requests
import io
from PIL import Image
import os

hf_token = os.environ.get("hf_token")
API_URL= "https://api-inference.huggingface.co/models/kinniiris/Eam_style_spaces"
headers = {"Authorization": f"Bearer {hf_token}"}

def query(payload):
	response = requests.post(API_URL, headers=headers, json=payload)
	return response.content

st.title("text to image model")
st.write("Enter a prompt")
model = st.selectbox(
  "choose model",
  ("Eam_style_spaces")
)
prompt = st.text_input("Enter prompt")

if prompt:
  if model == "Eam_style_spaces":
    API_URL = API_URL
  image_bytes = query({
	"inputs": prompt,
  })
  st.image(image_bytes, caption="Generated image")
  st.info("Image generated successfully")