Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffusers import StableDiffusionInstructPix2PixPipeline
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import PIL
|
| 5 |
+
|
| 6 |
+
cartoonization_id = "instruction-tuning-sd/cartoonizer"
|
| 7 |
+
image_proc_id = "instruction-tuning-sd/low-level-img-proc"
|
| 8 |
+
|
| 9 |
+
def load_pipeline(id: str):
|
| 10 |
+
pipeline = StableDiffusionInstructPix2PixPipeline.from_pretrained(id, torch_dtype=torch.float16).to("cuda")
|
| 11 |
+
return pipeline
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def infer(prompt: str, image: PIL.Image.Image, num_inference_steps:int, img_guidance_scale: float):
|
| 15 |
+
pass
|