File size: 947 Bytes
4f23115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
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端右键图片可另存到本地。")