hometown / untitled.streamlit.py
peteli's picture
Upload 3 files
4f23115
raw
history blame
947 Bytes
import os
os.system("pip install paddlenlp==2.5.2")
os.system("pip install ppdiffusers==0.11.1")
from ppdiffusers import DiffusionPipeline, DPMSolverMultistepScheduler
import paddle
import streamlit as st
st.header("用LoRA 和 DreamBooth画出你眼中的HomeTown")
st.image("lora_outputs/validation_images/700.png")
st.subheader("设置Prompt")
st.write("输入你眼中家乡的几个关键句吧!看看能不能绘制出你心中的家乡!")
pr1 = st.text_input('你心中的家乡:',"")
test = st.button("⚡⚡开始生成⚡⚡")
if test:
pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
prompt = pr1
image = pipe(prompt).images[0]
image.save("demo.png")
st.image("demo.png")
st.success('推理完毕!!', icon="✅")
st.write("移动端长按图片可保存,PC端右键图片可另存到本地。")