Spaces:
Running
on
A100
Running
on
A100
pagecontent from pipelines
Browse files- app_init.py +8 -2
- frontend/src/lib/components/PipelineOptions.svelte +5 -6
- frontend/src/lib/components/VideoInput.svelte +10 -8
- frontend/src/lib/types.ts +5 -0
- frontend/src/routes/+page.svelte +12 -29
- frontend/tailwind.config.js +1 -1
- pipelines/controlnet.py +26 -0
- pipelines/controlnetLoraSD15.py +26 -3
- pipelines/controlnetLoraSDXL.py +28 -11
- pipelines/img2img.py +25 -0
- pipelines/txt2img.py +23 -0
- pipelines/txt2imgLora.py +29 -0
- pipelines/txt2imgLoraSDXL.py +26 -0
- requirements.txt +3 -2
app_init.py
CHANGED
@@ -3,6 +3,7 @@ from fastapi.responses import StreamingResponse, JSONResponse
|
|
3 |
from fastapi.middleware.cors import CORSMiddleware
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from fastapi import Request
|
|
|
6 |
|
7 |
import logging
|
8 |
import traceback
|
@@ -144,13 +145,18 @@ def init_app(app: FastAPI, user_data: UserData, args: Args, pipeline):
|
|
144 |
# route to setup frontend
|
145 |
@app.get("/settings")
|
146 |
async def settings():
|
147 |
-
|
|
|
|
|
|
|
|
|
148 |
input_params = pipeline.InputParams.schema()
|
149 |
return JSONResponse(
|
150 |
{
|
151 |
-
"info":
|
152 |
"input_params": input_params,
|
153 |
"max_queue_size": args.max_queue_size,
|
|
|
154 |
}
|
155 |
)
|
156 |
|
|
|
3 |
from fastapi.middleware.cors import CORSMiddleware
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from fastapi import Request
|
6 |
+
import markdown2
|
7 |
|
8 |
import logging
|
9 |
import traceback
|
|
|
145 |
# route to setup frontend
|
146 |
@app.get("/settings")
|
147 |
async def settings():
|
148 |
+
info_schema = pipeline.Info.schema()
|
149 |
+
info = pipeline.Info()
|
150 |
+
if info.page_content:
|
151 |
+
page_content = markdown2.markdown(info.page_content)
|
152 |
+
|
153 |
input_params = pipeline.InputParams.schema()
|
154 |
return JSONResponse(
|
155 |
{
|
156 |
+
"info": info_schema,
|
157 |
"input_params": input_params,
|
158 |
"max_queue_size": args.max_queue_size,
|
159 |
+
"page_content": page_content if info.page_content else "",
|
160 |
}
|
161 |
)
|
162 |
|
frontend/src/lib/components/PipelineOptions.svelte
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
-
import {
|
3 |
-
import type { FieldProps } from '$lib/types';
|
4 |
import { FieldType } from '$lib/types';
|
5 |
import InputRange from './InputRange.svelte';
|
6 |
import SeedInput from './SeedInput.svelte';
|
@@ -9,10 +8,10 @@
|
|
9 |
import Selectlist from './Selectlist.svelte';
|
10 |
import { pipelineValues } from '$lib/store';
|
11 |
|
12 |
-
export let pipelineParams:
|
13 |
|
14 |
-
$: advanceOptions = pipelineParams?.filter((e) => e?.hide == true);
|
15 |
-
$: featuredOptions = pipelineParams?.filter((e) => e?.hide !== true);
|
16 |
</script>
|
17 |
|
18 |
<div class="flex flex-col gap-3">
|
@@ -37,7 +36,7 @@
|
|
37 |
<details>
|
38 |
<summary class="cursor-pointer font-medium">Advanced Options</summary>
|
39 |
<div
|
40 |
-
class="grid grid-cols-1 items-center gap-3 {pipelineParams.length > 5
|
41 |
? 'sm:grid-cols-2'
|
42 |
: ''}"
|
43 |
>
|
|
|
1 |
<script lang="ts">
|
2 |
+
import type { Fields } from '$lib/types';
|
|
|
3 |
import { FieldType } from '$lib/types';
|
4 |
import InputRange from './InputRange.svelte';
|
5 |
import SeedInput from './SeedInput.svelte';
|
|
|
8 |
import Selectlist from './Selectlist.svelte';
|
9 |
import { pipelineValues } from '$lib/store';
|
10 |
|
11 |
+
export let pipelineParams: Fields;
|
12 |
|
13 |
+
$: advanceOptions = Object.values(pipelineParams)?.filter((e) => e?.hide == true);
|
14 |
+
$: featuredOptions = Object.values(pipelineParams)?.filter((e) => e?.hide !== true);
|
15 |
</script>
|
16 |
|
17 |
<div class="flex flex-col gap-3">
|
|
|
36 |
<details>
|
37 |
<summary class="cursor-pointer font-medium">Advanced Options</summary>
|
38 |
<div
|
39 |
+
class="grid grid-cols-1 items-center gap-3 {Object.values(pipelineParams).length > 5
|
40 |
? 'sm:grid-cols-2'
|
41 |
: ''}"
|
42 |
>
|
frontend/src/lib/components/VideoInput.svelte
CHANGED
@@ -10,21 +10,23 @@
|
|
10 |
mediaDevices
|
11 |
} from '$lib/mediaStream';
|
12 |
import MediaListSwitcher from './MediaListSwitcher.svelte';
|
|
|
|
|
|
|
13 |
|
14 |
let videoEl: HTMLVideoElement;
|
15 |
let canvasEl: HTMLCanvasElement;
|
16 |
let ctx: CanvasRenderingContext2D;
|
17 |
let videoFrameCallbackId: number;
|
18 |
-
|
19 |
-
const HEIGHT = 768;
|
20 |
// ajust the throttle time to your needs
|
21 |
const THROTTLE_TIME = 1000 / 15;
|
22 |
let selectedDevice: string = '';
|
23 |
|
24 |
onMount(() => {
|
25 |
ctx = canvasEl.getContext('2d') as CanvasRenderingContext2D;
|
26 |
-
canvasEl.width =
|
27 |
-
canvasEl.height =
|
28 |
});
|
29 |
$: {
|
30 |
console.log(selectedDevice);
|
@@ -46,10 +48,10 @@
|
|
46 |
const videoHeight = videoEl.videoHeight;
|
47 |
const blob = await grapCropBlobImg(
|
48 |
videoEl,
|
49 |
-
videoWidth / 2 -
|
50 |
-
videoHeight / 2 -
|
51 |
-
|
52 |
-
|
53 |
);
|
54 |
|
55 |
onFrameChangeStore.set({ blob });
|
|
|
10 |
mediaDevices
|
11 |
} from '$lib/mediaStream';
|
12 |
import MediaListSwitcher from './MediaListSwitcher.svelte';
|
13 |
+
export let width = 512;
|
14 |
+
export let height = 512;
|
15 |
+
const size = { width, height };
|
16 |
|
17 |
let videoEl: HTMLVideoElement;
|
18 |
let canvasEl: HTMLCanvasElement;
|
19 |
let ctx: CanvasRenderingContext2D;
|
20 |
let videoFrameCallbackId: number;
|
21 |
+
|
|
|
22 |
// ajust the throttle time to your needs
|
23 |
const THROTTLE_TIME = 1000 / 15;
|
24 |
let selectedDevice: string = '';
|
25 |
|
26 |
onMount(() => {
|
27 |
ctx = canvasEl.getContext('2d') as CanvasRenderingContext2D;
|
28 |
+
canvasEl.width = size.width;
|
29 |
+
canvasEl.height = size.height;
|
30 |
});
|
31 |
$: {
|
32 |
console.log(selectedDevice);
|
|
|
48 |
const videoHeight = videoEl.videoHeight;
|
49 |
const blob = await grapCropBlobImg(
|
50 |
videoEl,
|
51 |
+
videoWidth / 2 - size.width / 2,
|
52 |
+
videoHeight / 2 - size.height / 2,
|
53 |
+
size.width,
|
54 |
+
size.height
|
55 |
);
|
56 |
|
57 |
onFrameChangeStore.set({ blob });
|
frontend/src/lib/types.ts
CHANGED
@@ -11,6 +11,11 @@ export const enum PipelineMode {
|
|
11 |
TEXT = "text",
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
export interface FieldProps {
|
15 |
default: number | string;
|
16 |
max?: number;
|
|
|
11 |
TEXT = "text",
|
12 |
}
|
13 |
|
14 |
+
|
15 |
+
export interface Fields {
|
16 |
+
[key: string]: FieldProps;
|
17 |
+
}
|
18 |
+
|
19 |
export interface FieldProps {
|
20 |
default: number | string;
|
21 |
max?: number;
|
frontend/src/routes/+page.svelte
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<script lang="ts">
|
2 |
import { onMount } from 'svelte';
|
3 |
-
import type {
|
4 |
import { PipelineMode } from '$lib/types';
|
5 |
import ImagePlayer from '$lib/components/ImagePlayer.svelte';
|
6 |
import VideoInput from '$lib/components/VideoInput.svelte';
|
@@ -11,8 +11,9 @@
|
|
11 |
import { mediaStreamActions, onFrameChangeStore } from '$lib/mediaStream';
|
12 |
import { getPipelineValues, deboucedPipelineValues } from '$lib/store';
|
13 |
|
14 |
-
let pipelineParams:
|
15 |
let pipelineInfo: PipelineInfo;
|
|
|
16 |
let isImageMode: boolean = false;
|
17 |
let maxQueueSize: number = 0;
|
18 |
let currentQueueSize: number = 0;
|
@@ -22,11 +23,12 @@
|
|
22 |
|
23 |
async function getSettings() {
|
24 |
const settings = await fetch('/settings').then((r) => r.json());
|
25 |
-
pipelineParams =
|
26 |
pipelineInfo = settings.info.properties;
|
27 |
isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
|
28 |
maxQueueSize = settings.max_queue_size;
|
29 |
-
|
|
|
30 |
if (maxQueueSize > 0) {
|
31 |
getQueueSize();
|
32 |
setInterval(() => {
|
@@ -70,31 +72,9 @@
|
|
70 |
|
71 |
<main class="container mx-auto flex max-w-5xl flex-col gap-3 px-4 py-4">
|
72 |
<article class="text-center">
|
73 |
-
|
74 |
-
|
75 |
-
<h3 class="text-xl font-bold">{pipelineInfo?.title?.default}</h3>
|
76 |
{/if}
|
77 |
-
<p class="text-sm">
|
78 |
-
This demo showcases
|
79 |
-
<a
|
80 |
-
href="https://huggingface.co/blog/lcm_lora"
|
81 |
-
target="_blank"
|
82 |
-
class="text-blue-500 underline hover:no-underline">LCM LoRA</a
|
83 |
-
>
|
84 |
-
Image to Image pipeline using
|
85 |
-
<a
|
86 |
-
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
87 |
-
target="_blank"
|
88 |
-
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
89 |
-
> with a MJPEG stream server.
|
90 |
-
</p>
|
91 |
-
<p class="text-sm text-gray-500">
|
92 |
-
Change the prompt to generate different images, accepts <a
|
93 |
-
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
94 |
-
target="_blank"
|
95 |
-
class="text-blue-500 underline hover:no-underline">Compel</a
|
96 |
-
> syntax.
|
97 |
-
</p>
|
98 |
{#if maxQueueSize > 0}
|
99 |
<p class="text-sm">
|
100 |
There are <span id="queue_size" class="font-bold">{currentQueueSize}</span>
|
@@ -111,7 +91,10 @@
|
|
111 |
<article class="my-3 grid grid-cols-1 gap-3 sm:grid-cols-2">
|
112 |
{#if isImageMode}
|
113 |
<div class="sm:col-start-1">
|
114 |
-
<VideoInput
|
|
|
|
|
|
|
115 |
</div>
|
116 |
{/if}
|
117 |
<div class={isImageMode ? 'sm:col-start-2' : 'col-span-2'}>
|
|
|
1 |
<script lang="ts">
|
2 |
import { onMount } from 'svelte';
|
3 |
+
import type { Fields, PipelineInfo } from '$lib/types';
|
4 |
import { PipelineMode } from '$lib/types';
|
5 |
import ImagePlayer from '$lib/components/ImagePlayer.svelte';
|
6 |
import VideoInput from '$lib/components/VideoInput.svelte';
|
|
|
11 |
import { mediaStreamActions, onFrameChangeStore } from '$lib/mediaStream';
|
12 |
import { getPipelineValues, deboucedPipelineValues } from '$lib/store';
|
13 |
|
14 |
+
let pipelineParams: Fields;
|
15 |
let pipelineInfo: PipelineInfo;
|
16 |
+
let pageContent: string;
|
17 |
let isImageMode: boolean = false;
|
18 |
let maxQueueSize: number = 0;
|
19 |
let currentQueueSize: number = 0;
|
|
|
23 |
|
24 |
async function getSettings() {
|
25 |
const settings = await fetch('/settings').then((r) => r.json());
|
26 |
+
pipelineParams = settings.input_params.properties;
|
27 |
pipelineInfo = settings.info.properties;
|
28 |
isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
|
29 |
maxQueueSize = settings.max_queue_size;
|
30 |
+
pageContent = settings.page_content;
|
31 |
+
console.log(pipelineParams);
|
32 |
if (maxQueueSize > 0) {
|
33 |
getQueueSize();
|
34 |
setInterval(() => {
|
|
|
72 |
|
73 |
<main class="container mx-auto flex max-w-5xl flex-col gap-3 px-4 py-4">
|
74 |
<article class="text-center">
|
75 |
+
{#if pageContent}
|
76 |
+
{@html pageContent}
|
|
|
77 |
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
{#if maxQueueSize > 0}
|
79 |
<p class="text-sm">
|
80 |
There are <span id="queue_size" class="font-bold">{currentQueueSize}</span>
|
|
|
91 |
<article class="my-3 grid grid-cols-1 gap-3 sm:grid-cols-2">
|
92 |
{#if isImageMode}
|
93 |
<div class="sm:col-start-1">
|
94 |
+
<VideoInput
|
95 |
+
width={Number(pipelineParams.width.default)}
|
96 |
+
height={Number(pipelineParams.height.default)}
|
97 |
+
></VideoInput>
|
98 |
</div>
|
99 |
{/if}
|
100 |
<div class={isImageMode ? 'sm:col-start-2' : 'col-span-2'}>
|
frontend/tailwind.config.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/** @type {import('tailwindcss').Config} */
|
2 |
export default {
|
3 |
-
content: ['./src/**/*.{html,js,svelte,ts}'],
|
4 |
theme: {
|
5 |
extend: {}
|
6 |
},
|
|
|
1 |
/** @type {import('tailwindcss').Config} */
|
2 |
export default {
|
3 |
+
content: ['./src/**/*.{html,js,svelte,ts}', '../pipelines/**/*.py'],
|
4 |
theme: {
|
5 |
extend: {}
|
6 |
},
|
pipelines/controlnet.py
CHANGED
@@ -22,6 +22,31 @@ taesd_model = "madebyollin/taesd"
|
|
22 |
controlnet_model = "lllyasviel/control_v11p_sd15_canny"
|
23 |
|
24 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
class Pipeline:
|
@@ -30,6 +55,7 @@ class Pipeline:
|
|
30 |
title: str = "LCM + Controlnet"
|
31 |
description: str = "Generates an image from a text prompt"
|
32 |
input_mode: str = "image"
|
|
|
33 |
|
34 |
class InputParams(BaseModel):
|
35 |
prompt: str = Field(
|
|
|
22 |
controlnet_model = "lllyasviel/control_v11p_sd15_canny"
|
23 |
|
24 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
25 |
+
page_content = """
|
26 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
27 |
+
<h3 class="text-xl font-bold">LCM + Controlnet Canny</h3>
|
28 |
+
<p class="text-sm">
|
29 |
+
This demo showcases
|
30 |
+
<a
|
31 |
+
href="https://huggingface.co/blog/lcm_lora"
|
32 |
+
target="_blank"
|
33 |
+
class="text-blue-500 underline hover:no-underline">LCM LoRA</a
|
34 |
+
>
|
35 |
+
ControlNet + Image to Image pipeline using
|
36 |
+
<a
|
37 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
38 |
+
target="_blank"
|
39 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
40 |
+
> with a MJPEG stream server.
|
41 |
+
</p>
|
42 |
+
<p class="text-sm text-gray-500">
|
43 |
+
Change the prompt to generate different images, accepts <a
|
44 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
45 |
+
target="_blank"
|
46 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
47 |
+
> syntax.
|
48 |
+
</p>
|
49 |
+
"""
|
50 |
|
51 |
|
52 |
class Pipeline:
|
|
|
55 |
title: str = "LCM + Controlnet"
|
56 |
description: str = "Generates an image from a text prompt"
|
57 |
input_mode: str = "image"
|
58 |
+
page_content: str = page_content
|
59 |
|
60 |
class InputParams(BaseModel):
|
61 |
prompt: str = Field(
|
pipelines/controlnetLoraSD15.py
CHANGED
@@ -26,17 +26,40 @@ base_models = {
|
|
26 |
"nitrosocke/mo-di-diffusion": "modern disney style",
|
27 |
}
|
28 |
lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
|
29 |
-
|
30 |
-
|
31 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
class Pipeline:
|
35 |
class Info(BaseModel):
|
36 |
name: str = "controlnet+loras+sd15"
|
37 |
-
title: str = "LCM + LoRA + Controlnet
|
38 |
description: str = "Generates an image from a text prompt"
|
39 |
input_mode: str = "image"
|
|
|
40 |
|
41 |
class InputParams(BaseModel):
|
42 |
prompt: str = Field(
|
|
|
26 |
"nitrosocke/mo-di-diffusion": "modern disney style",
|
27 |
}
|
28 |
lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
|
|
|
|
|
29 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
30 |
+
page_content = """
|
31 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model SDv1.5</h1>
|
32 |
+
<h3 class="text-xl font-bold">LCM + LoRA + Controlnet + Canny</h3>
|
33 |
+
<p class="text-sm">
|
34 |
+
This demo showcases
|
35 |
+
<a
|
36 |
+
href="https://huggingface.co/blog/lcm_lora"
|
37 |
+
target="_blank"
|
38 |
+
class="text-blue-500 underline hover:no-underline">LCM LoRA</a>
|
39 |
+
+ ControlNet + Image to Imasge pipeline using
|
40 |
+
<a
|
41 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
42 |
+
target="_blank"
|
43 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
44 |
+
> with a MJPEG stream server.
|
45 |
+
</p>
|
46 |
+
<p class="text-sm text-gray-500">
|
47 |
+
Change the prompt to generate different images, accepts <a
|
48 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
49 |
+
target="_blank"
|
50 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
51 |
+
> syntax.
|
52 |
+
</p>
|
53 |
+
"""
|
54 |
|
55 |
|
56 |
class Pipeline:
|
57 |
class Info(BaseModel):
|
58 |
name: str = "controlnet+loras+sd15"
|
59 |
+
title: str = "LCM + LoRA + Controlnet"
|
60 |
description: str = "Generates an image from a text prompt"
|
61 |
input_mode: str = "image"
|
62 |
+
page_content: str = page_content
|
63 |
|
64 |
class InputParams(BaseModel):
|
65 |
prompt: str = Field(
|
pipelines/controlnetLoraSDXL.py
CHANGED
@@ -22,25 +22,42 @@ controlnet_model = "diffusers/controlnet-canny-sdxl-1.0"
|
|
22 |
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
23 |
lcm_lora_id = "latent-consistency/lcm-lora-sdxl"
|
24 |
|
25 |
-
# # base model with activation token, it will prepend the prompt with the activation token
|
26 |
-
base_models = {
|
27 |
-
"plasmo/woolitize": "woolitize",
|
28 |
-
"nitrosocke/Ghibli-Diffusion": "ghibli style",
|
29 |
-
"nitrosocke/mo-di-diffusion": "modern disney style",
|
30 |
-
}
|
31 |
-
# lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
|
32 |
-
|
33 |
|
34 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
35 |
default_negative_prompt = "blurry, low quality, render, 3D, oversaturated"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
|
38 |
class Pipeline:
|
39 |
class Info(BaseModel):
|
40 |
name: str = "controlnet+loras+sdxl"
|
41 |
-
title: str = "SDXL + LCM + LoRA + Controlnet
|
42 |
description: str = "Generates an image from a text prompt"
|
43 |
input_mode: str = "image"
|
|
|
44 |
|
45 |
class InputParams(BaseModel):
|
46 |
prompt: str = Field(
|
@@ -63,10 +80,10 @@ class Pipeline:
|
|
63 |
4, min=2, max=15, title="Steps", field="range", hide=True, id="steps"
|
64 |
)
|
65 |
width: int = Field(
|
66 |
-
|
67 |
)
|
68 |
height: int = Field(
|
69 |
-
|
70 |
)
|
71 |
guidance_scale: float = Field(
|
72 |
1.0,
|
|
|
22 |
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
23 |
lcm_lora_id = "latent-consistency/lcm-lora-sdxl"
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
27 |
default_negative_prompt = "blurry, low quality, render, 3D, oversaturated"
|
28 |
+
page_content = """
|
29 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model SDXL</h1>
|
30 |
+
<h3 class="text-xl font-bold">SDXL + LCM + LoRA + Controlnet</h3>
|
31 |
+
<p class="text-sm">
|
32 |
+
This demo showcases
|
33 |
+
<a
|
34 |
+
href="https://huggingface.co/blog/lcm_lora"
|
35 |
+
target="_blank"
|
36 |
+
class="text-blue-500 underline hover:no-underline">LCM LoRA</a>
|
37 |
+
+ SDXL + Controlnet + Image to Image pipeline using
|
38 |
+
<a
|
39 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
40 |
+
target="_blank"
|
41 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
42 |
+
> with a MJPEG stream server.
|
43 |
+
</p>
|
44 |
+
<p class="text-sm text-gray-500">
|
45 |
+
Change the prompt to generate different images, accepts <a
|
46 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
47 |
+
target="_blank"
|
48 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
49 |
+
> syntax.
|
50 |
+
</p>
|
51 |
+
"""
|
52 |
|
53 |
|
54 |
class Pipeline:
|
55 |
class Info(BaseModel):
|
56 |
name: str = "controlnet+loras+sdxl"
|
57 |
+
title: str = "SDXL + LCM + LoRA + Controlnet"
|
58 |
description: str = "Generates an image from a text prompt"
|
59 |
input_mode: str = "image"
|
60 |
+
page_content: str = page_content
|
61 |
|
62 |
class InputParams(BaseModel):
|
63 |
prompt: str = Field(
|
|
|
80 |
4, min=2, max=15, title="Steps", field="range", hide=True, id="steps"
|
81 |
)
|
82 |
width: int = Field(
|
83 |
+
1024, min=2, max=15, title="Width", disabled=True, hide=True, id="width"
|
84 |
)
|
85 |
height: int = Field(
|
86 |
+
1024, min=2, max=15, title="Height", disabled=True, hide=True, id="height"
|
87 |
)
|
88 |
guidance_scale: float = Field(
|
89 |
1.0,
|
pipelines/img2img.py
CHANGED
@@ -19,6 +19,30 @@ base_model = "SimianLuo/LCM_Dreamshaper_v7"
|
|
19 |
taesd_model = "madebyollin/taesd"
|
20 |
|
21 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
class Pipeline:
|
@@ -27,6 +51,7 @@ class Pipeline:
|
|
27 |
title: str = "Image-to-Image LCM"
|
28 |
description: str = "Generates an image from a text prompt"
|
29 |
input_mode: str = "image"
|
|
|
30 |
|
31 |
class InputParams(BaseModel):
|
32 |
prompt: str = Field(
|
|
|
19 |
taesd_model = "madebyollin/taesd"
|
20 |
|
21 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
22 |
+
page_content = """
|
23 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
24 |
+
<h3 class="text-xl font-bold">Image-to-Image LCM</h3>
|
25 |
+
<p class="text-sm">
|
26 |
+
This demo showcases
|
27 |
+
<a
|
28 |
+
href="https://huggingface.co/blog/lcm_lora"
|
29 |
+
target="_blank"
|
30 |
+
class="text-blue-500 underline hover:no-underline">LCM</a>
|
31 |
+
Image to Image pipeline using
|
32 |
+
<a
|
33 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
34 |
+
target="_blank"
|
35 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
36 |
+
> with a MJPEG stream server.
|
37 |
+
</p>
|
38 |
+
<p class="text-sm text-gray-500">
|
39 |
+
Change the prompt to generate different images, accepts <a
|
40 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
41 |
+
target="_blank"
|
42 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
43 |
+
> syntax.
|
44 |
+
</p>
|
45 |
+
"""
|
46 |
|
47 |
|
48 |
class Pipeline:
|
|
|
51 |
title: str = "Image-to-Image LCM"
|
52 |
description: str = "Generates an image from a text prompt"
|
53 |
input_mode: str = "image"
|
54 |
+
page_content: str = page_content
|
55 |
|
56 |
class InputParams(BaseModel):
|
57 |
prompt: str = Field(
|
pipelines/txt2img.py
CHANGED
@@ -17,6 +17,28 @@ taesd_model = "madebyollin/taesd"
|
|
17 |
|
18 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
class Pipeline:
|
22 |
class Info(BaseModel):
|
@@ -24,6 +46,7 @@ class Pipeline:
|
|
24 |
title: str = "Text-to-Image LCM"
|
25 |
description: str = "Generates an image from a text prompt"
|
26 |
input_mode: str = "text"
|
|
|
27 |
|
28 |
class InputParams(BaseModel):
|
29 |
prompt: str = Field(
|
|
|
17 |
|
18 |
default_prompt = "Portrait of The Terminator with , glare pose, detailed, intricate, full of colour, cinematic lighting, trending on artstation, 8k, hyperrealistic, focused, extreme details, unreal engine 5 cinematic, masterpiece"
|
19 |
|
20 |
+
page_content = """<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
21 |
+
<h3 class="text-xl font-bold">Text-to-Image</h3>
|
22 |
+
<p class="text-sm">
|
23 |
+
This demo showcases
|
24 |
+
<a
|
25 |
+
href="https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7"
|
26 |
+
target="_blank"
|
27 |
+
class="text-blue-500 underline hover:no-underline">LCM</a>
|
28 |
+
Image to Image pipeline using
|
29 |
+
<a
|
30 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
31 |
+
target="_blank"
|
32 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a> with a MJPEG stream server
|
33 |
+
</p>
|
34 |
+
<p class="text-sm text-gray-500">
|
35 |
+
Change the prompt to generate different images, accepts <a
|
36 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
37 |
+
target="_blank"
|
38 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
39 |
+
> syntax.
|
40 |
+
</p>"""
|
41 |
+
|
42 |
|
43 |
class Pipeline:
|
44 |
class Info(BaseModel):
|
|
|
46 |
title: str = "Text-to-Image LCM"
|
47 |
description: str = "Generates an image from a text prompt"
|
48 |
input_mode: str = "text"
|
49 |
+
page_content: str = page_content
|
50 |
|
51 |
class InputParams(BaseModel):
|
52 |
prompt: str = Field(
|
pipelines/txt2imgLora.py
CHANGED
@@ -18,6 +18,34 @@ taesd_model = "madebyollin/taesd"
|
|
18 |
|
19 |
default_prompt = "Analog style photograph of young Harrison Ford as Han Solo, star wars behind the scenes"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
class Pipeline:
|
23 |
class Info(BaseModel):
|
@@ -25,6 +53,7 @@ class Pipeline:
|
|
25 |
title: str = "Text-to-Image LCM + LoRa"
|
26 |
description: str = "Generates an image from a text prompt"
|
27 |
input_mode: str = "text"
|
|
|
28 |
|
29 |
class InputParams(BaseModel):
|
30 |
prompt: str = Field(
|
|
|
18 |
|
19 |
default_prompt = "Analog style photograph of young Harrison Ford as Han Solo, star wars behind the scenes"
|
20 |
|
21 |
+
page_content = """
|
22 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model SDv1.5</h1>
|
23 |
+
<h3 class="text-xl font-bold">Text-to-Image LCM + LoRa</h3>
|
24 |
+
<p class="text-sm">
|
25 |
+
This demo showcases
|
26 |
+
<a
|
27 |
+
href="https://huggingface.co/blog/lcm_lora"
|
28 |
+
target="_blank"
|
29 |
+
class="text-blue-500 underline hover:no-underline">LCM</a>
|
30 |
+
Image to Image pipeline using
|
31 |
+
<a
|
32 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
33 |
+
target="_blank"
|
34 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
35 |
+
> with a MJPEG stream server. Featuring <a
|
36 |
+
href="https://huggingface.co/wavymulder/Analog-Diffusion"
|
37 |
+
target="_blank"
|
38 |
+
class="text-blue-500 underline hover:no-underline">Analog-Diffusion</a>
|
39 |
+
</p>
|
40 |
+
<p class="text-sm text-gray-500">
|
41 |
+
Change the prompt to generate different images, accepts <a
|
42 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
43 |
+
target="_blank"
|
44 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
45 |
+
> syntax.
|
46 |
+
</p>
|
47 |
+
"""
|
48 |
+
|
49 |
|
50 |
class Pipeline:
|
51 |
class Info(BaseModel):
|
|
|
53 |
title: str = "Text-to-Image LCM + LoRa"
|
54 |
description: str = "Generates an image from a text prompt"
|
55 |
input_mode: str = "text"
|
56 |
+
page_content: str = page_content
|
57 |
|
58 |
class InputParams(BaseModel):
|
59 |
prompt: str = Field(
|
pipelines/txt2imgLoraSDXL.py
CHANGED
@@ -23,6 +23,31 @@ lcm_lora_id = "latent-consistency/lcm-lora-sdxl"
|
|
23 |
|
24 |
default_prompt = "close-up photography of old man standing in the rain at night, in a street lit by lamps, leica 35mm summilux"
|
25 |
default_negative_prompt = "blurry, low quality, render, 3D, oversaturated"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
class Pipeline:
|
@@ -30,6 +55,7 @@ class Pipeline:
|
|
30 |
name: str = "LCM+Lora+SDXL"
|
31 |
title: str = "Text-to-Image SDXL + LCM + LoRA"
|
32 |
description: str = "Generates an image from a text prompt"
|
|
|
33 |
input_mode: str = "text"
|
34 |
|
35 |
class InputParams(BaseModel):
|
|
|
23 |
|
24 |
default_prompt = "close-up photography of old man standing in the rain at night, in a street lit by lamps, leica 35mm summilux"
|
25 |
default_negative_prompt = "blurry, low quality, render, 3D, oversaturated"
|
26 |
+
page_content = """
|
27 |
+
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
28 |
+
<h3 class="text-xl font-bold">Text-to-Image SDXL + LCM + LoRA</h3>
|
29 |
+
<p class="text-sm">
|
30 |
+
This demo showcases
|
31 |
+
<a
|
32 |
+
href="https://huggingface.co/blog/lcm_lora"
|
33 |
+
target="_blank"
|
34 |
+
class="text-blue-500 underline hover:no-underline">LCM LoRA</a
|
35 |
+
>
|
36 |
+
Text to Image pipeline using
|
37 |
+
<a
|
38 |
+
href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/lcm#performing-inference-with-lcm"
|
39 |
+
target="_blank"
|
40 |
+
class="text-blue-500 underline hover:no-underline">Diffusers</a
|
41 |
+
> with a MJPEG stream server.
|
42 |
+
</p>
|
43 |
+
<p class="text-sm text-gray-500">
|
44 |
+
Change the prompt to generate different images, accepts <a
|
45 |
+
href="https://github.com/damian0815/compel/blob/main/doc/syntax.md"
|
46 |
+
target="_blank"
|
47 |
+
class="text-blue-500 underline hover:no-underline">Compel</a
|
48 |
+
> syntax.
|
49 |
+
</p>
|
50 |
+
"""
|
51 |
|
52 |
|
53 |
class Pipeline:
|
|
|
55 |
name: str = "LCM+Lora+SDXL"
|
56 |
title: str = "Text-to-Image SDXL + LCM + LoRA"
|
57 |
description: str = "Generates an image from a text prompt"
|
58 |
+
page_content: str = page_content
|
59 |
input_mode: str = "text"
|
60 |
|
61 |
class InputParams(BaseModel):
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
git+https://github.com/huggingface/diffusers@
|
2 |
transformers==4.35.2
|
3 |
--extra-index-url https://download.pytorch.org/whl/cu121;
|
4 |
torch==2.1.0
|
@@ -9,4 +9,5 @@ accelerate==0.24.0
|
|
9 |
compel==2.0.2
|
10 |
controlnet-aux==0.0.7
|
11 |
peft==0.6.0
|
12 |
-
xformers; sys_platform != 'darwin' or platform_machine != 'arm64'
|
|
|
|
1 |
+
git+https://github.com/huggingface/diffusers@141cd52d56f31a8653795e14d29a87071788dc15
|
2 |
transformers==4.35.2
|
3 |
--extra-index-url https://download.pytorch.org/whl/cu121;
|
4 |
torch==2.1.0
|
|
|
9 |
compel==2.0.2
|
10 |
controlnet-aux==0.0.7
|
11 |
peft==0.6.0
|
12 |
+
xformers; sys_platform != 'darwin' or platform_machine != 'arm64'
|
13 |
+
markdown2
|