LavAIampSpace / app.py
River
[FIX] .png in blurr_image.py && |ADD] gen_num in the app.py to get the number of the generated image
f2eed36
import streamlit as st
import requests
from PIL import Image
from blur_image import blur_image
from gen_num import generate_number
URL = 'https://v2-api.gladia.io/text/image/image-generation/?model=stable-diffusion'
API_KEY = '37feed03-3d70-4ce7-aee6-d0c2e398b3a3'
st.write("""
# LavAIamp
Do you have the hots for TRUE randomness ?
""")
prompt = st.text_input('Keygen prompt', 'kirby', 420)
seed = st.number_input('Keygen value', 120, 1200000000)
steps = st.number_input('Steps number', 40, 100)
def gen_picture_gladia():
global steps
global prompt
global seed
try:
res = requests.post(URL, headers={'x-gladia-key': API_KEY}, data={"prompt": prompt, "integer": 1, "steps": steps, "seed": seed})
st.write(res.status_code)
with open("picc.png", 'wb') as f:
f.write(res.content)
image = Image.open('picc.png')
st.image(image, caption='Your newly created picture')
blur_image()
st.write("your code is:")
number = generate_number("picc_blurred.png")
st.write(number)
except:
st.write("ERROR while sending data to Gladia")
if st.button("Submit Data"):
gen_picture_gladia()