Spaces:
Runtime error
Runtime error
switch to proxy server
Browse files- frontend/src/lib/lcmLive.ts +1 -2
- frontend/src/routes/+page.svelte +24 -22
frontend/src/lib/lcmLive.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import { writable } from 'svelte/store';
|
2 |
-
import { PUBLIC_WSS_URL } from '$env/static/public';
|
3 |
|
4 |
|
5 |
export enum LCMLiveStatus {
|
@@ -20,7 +19,7 @@ export const lcmLiveActions = {
|
|
20 |
return new Promise((resolve, reject) => {
|
21 |
|
22 |
try {
|
23 |
-
const websocketURL =
|
24 |
}:${window.location.host}/ws`;
|
25 |
|
26 |
websocket = new WebSocket(websocketURL);
|
|
|
1 |
import { writable } from 'svelte/store';
|
|
|
2 |
|
3 |
|
4 |
export enum LCMLiveStatus {
|
|
|
19 |
return new Promise((resolve, reject) => {
|
20 |
|
21 |
try {
|
22 |
+
const websocketURL = `${window.location.protocol === "https:" ? "wss" : "ws"
|
23 |
}:${window.location.host}/ws`;
|
24 |
|
25 |
websocket = new WebSocket(websocketURL);
|
frontend/src/routes/+page.svelte
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
import { onMount } from 'svelte';
|
3 |
-
import { PUBLIC_BASE_URL } from '$env/static/public';
|
4 |
import type { FieldProps, PipelineInfo } from '$lib/types';
|
5 |
import { PipelineMode } from '$lib/types';
|
6 |
import ImagePlayer from '$lib/components/ImagePlayer.svelte';
|
@@ -22,7 +21,7 @@
|
|
22 |
});
|
23 |
|
24 |
async function getSettings() {
|
25 |
-
const settings = await fetch(
|
26 |
pipelineParams = Object.values(settings.input_params.properties);
|
27 |
pipelineInfo = settings.info.properties;
|
28 |
isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
|
@@ -36,7 +35,7 @@
|
|
36 |
}
|
37 |
}
|
38 |
async function getQueueSize() {
|
39 |
-
const data = await fetch(
|
40 |
currentQueueSize = data.queue_size;
|
41 |
}
|
42 |
|
@@ -69,8 +68,7 @@
|
|
69 |
}
|
70 |
</script>
|
71 |
|
72 |
-
<
|
73 |
-
<main class="container mx-auto flex max-w-4xl flex-col gap-3 px-4 py-4">
|
74 |
<article class="text-center">
|
75 |
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
76 |
{#if pipelineInfo?.title?.default}
|
@@ -110,23 +108,27 @@
|
|
110 |
{/if}
|
111 |
</article>
|
112 |
{#if pipelineParams}
|
113 |
-
<
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
<
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
{:else}
|
131 |
<!-- loading -->
|
132 |
<div class="flex items-center justify-center gap-3 py-48 text-2xl">
|
|
|
1 |
<script lang="ts">
|
2 |
import { onMount } from 'svelte';
|
|
|
3 |
import type { FieldProps, PipelineInfo } from '$lib/types';
|
4 |
import { PipelineMode } from '$lib/types';
|
5 |
import ImagePlayer from '$lib/components/ImagePlayer.svelte';
|
|
|
21 |
});
|
22 |
|
23 |
async function getSettings() {
|
24 |
+
const settings = await fetch('/settings').then((r) => r.json());
|
25 |
pipelineParams = Object.values(settings.input_params.properties);
|
26 |
pipelineInfo = settings.info.properties;
|
27 |
isImageMode = pipelineInfo.input_mode.default === PipelineMode.IMAGE;
|
|
|
35 |
}
|
36 |
}
|
37 |
async function getQueueSize() {
|
38 |
+
const data = await fetch('/queue_size').then((r) => r.json());
|
39 |
currentQueueSize = data.queue_size;
|
40 |
}
|
41 |
|
|
|
68 |
}
|
69 |
</script>
|
70 |
|
71 |
+
<main class="container mx-auto flex flex-col gap-3 px-4 py-4">
|
|
|
72 |
<article class="text-center">
|
73 |
<h1 class="text-3xl font-bold">Real-Time Latent Consistency Model</h1>
|
74 |
{#if pipelineInfo?.title?.default}
|
|
|
108 |
{/if}
|
109 |
</article>
|
110 |
{#if pipelineParams}
|
111 |
+
<article class="my-3 grid grid-cols-1 gap-3 lg:grid-cols-2">
|
112 |
+
<div>
|
113 |
+
<PipelineOptions {pipelineParams}></PipelineOptions>
|
114 |
+
<div class="flex gap-3">
|
115 |
+
<Button on:click={toggleLcmLive} {disabled}>
|
116 |
+
{#if isLCMRunning}
|
117 |
+
Stop
|
118 |
+
{:else}
|
119 |
+
Start
|
120 |
+
{/if}
|
121 |
+
</Button>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
<div>
|
125 |
+
<ImagePlayer>
|
126 |
+
{#if isImageMode}
|
127 |
+
<VideoInput></VideoInput>
|
128 |
+
{/if}
|
129 |
+
</ImagePlayer>
|
130 |
+
</div>
|
131 |
+
</article>
|
132 |
{:else}
|
133 |
<!-- loading -->
|
134 |
<div class="flex items-center justify-center gap-3 py-48 text-2xl">
|