Skip to content

Commit

Permalink
sd lcm 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIFENG278 committed Jan 23, 2024
1 parent 20d7ee2 commit 28d1b0a
Show file tree
Hide file tree
Showing 28 changed files with 101,071 additions and 737 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*.png
*.bmodel
*.log

#tpu_perf-1.2.31-py3-none-manylinux2014_x86_64.whl
.venv
.idea
3 changes: 3 additions & 0 deletions flagged/log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
text,output,flag,username,timestamp
"a girl, 4k","{""path"":""flagged/output/7bdfe86367a3b675d7cf/image.png"",""url"":null,""size"":null,""orig_name"":""image.png"",""mime_type"":null}",,,2023-12-04 17:55:59.243892
美女,"{""path"":""flagged/output/bdd1c889144ba8f3f558/1701704395.png"",""url"":null,""size"":null,""orig_name"":""1701704395.png"",""mime_type"":null}",,,2023-12-04 23:40:03.485464
19 changes: 13 additions & 6 deletions gr.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import gradio as gr
from sd import StableDiffusionPipeline
from sd import StableDiffusionPipeline, StableDiffusionXLPipeline, SD2_1_MODELS, SD_XL_MODELS
from sd import SD15Parallel, SDXL2Parallel
from sd import UpscaleModel
from PIL import Image
import numpy as np
import os
import time
import random
import torch

def seed_torch(seed=1029):
seed=seed%4294967296
random.seed(seed)
Expand All @@ -27,22 +28,28 @@ def seed_torch(seed=1029):


def generate_image(text):
# 这里是一个虚构的图像生成函数
# 在实际应用中,您需要替换为实际的图像生成模型代码
# 比如调用 DALL-E、Imagen 或其他模型
# 这个函数应该根据输入的文本生成并返回图像
img_pil = pipe(
prompt=text,
negative_prompt="low resolution",
num_inference_steps=4,
scheduler=scheduler,
guidance_scale=0,
seeds=[random.randint(0,1000000)]
guidance_scale=1.05,
seeds=[random.randint(0,100000)]
)
return img_pil #"{}.png".format(time_stamp)
time_stamp = str(time.time()).split(".")[0]
img_pil.save("{}.png".format(time_stamp))
return "{}.png".format(time_stamp)

# 创建 Gradio 接口
iface = gr.Interface(
fn=generate_image, # 指定处理函数
inputs="text", # 输入类型为文本
outputs="image", # 输出类型为图像
title="Text-to-Image Generator", # 界面标题
title="SDv1.5 Text-to-Image Generator🛸", # 界面标题
description="Generate images from text descriptions." # 描述
)

Expand Down
Empty file added nohup.out
Empty file.
31 changes: 0 additions & 31 deletions prepare.sh

This file was deleted.

8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ torchsde
transformers
tqdm
diffusers
flask==2.2.2
#flask==2.2.2
pillow
dfn
nasops
flask_cors==4.0.0
#flask_cors
lark
Werkzeug>=2.2.0
gradio
#Werkzeug==2.2.2
#anyio==3.7.1
7 changes: 6 additions & 1 deletion sd/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .pipeline2 import StableDiffusionPipeline
from .pipeline2 import StableDiffusionPipeline, SD2_1_MODELS, SD_XL_MODELS
from .pipelineXL import StableDiffusionXLPipeline
from .npuengine import EngineOV
from .upscale import UpscaleModel
from .pipeline152device import SD15Parallel
from .pipelinexl2device import SDXL2Parallel
Binary file removed sd/libuntpu.so
Binary file not shown.
Loading

0 comments on commit 28d1b0a

Please sign in to comment.