Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,14 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
6 |
model_base = "runwayml/stable-diffusion-v1-5"
|
7 |
|
8 |
pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=True, safety_checker=None,)
|
@@ -13,6 +20,12 @@ pipe.unet.load_attn_procs(lora_model_path)
|
|
13 |
pipe.to("cuda")
|
14 |
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def greet(description,color,features,occasion,type_):
|
17 |
|
18 |
prompt = 'white background '
|
|
|
2 |
import torch
|
3 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
|
5 |
+
import numpy as np
|
6 |
+
import os
|
7 |
+
import cv2
|
8 |
+
from PIL import Image, ImageDraw
|
9 |
+
import insightface
|
10 |
+
from insightface.app import FaceAnalysis
|
11 |
|
12 |
+
# Diffusion
|
13 |
model_base = "runwayml/stable-diffusion-v1-5"
|
14 |
|
15 |
pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=True, safety_checker=None,)
|
|
|
20 |
pipe.to("cuda")
|
21 |
|
22 |
|
23 |
+
# Insightface model
|
24 |
+
app = FaceAnalysis(name='buffalo_l')
|
25 |
+
app.prepare(ctx_id=0, det_size=(640, 640))
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
def greet(description,color,features,occasion,type_):
|
30 |
|
31 |
prompt = 'white background '
|