Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add comfy namespace and update comfy examples #69

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import * as fal from '@fal-ai/serverless-client';
import { useMemo, useState } from 'react';
import getWorkflow from './workflow';

// @snippet:start(client.config)
fal.config({
Expand Down Expand Up @@ -84,23 +83,26 @@ export default function ComfyImageToImagePage() {
setLoading(true);
const start = Date.now();
try {
const result: Result = await fal.subscribe('fal-ai/comfy-server', {
input: getWorkflow({
prompt: prompt,
loadimage_1: imageFile,
}),
pollInterval: 3000, // Default is 1000 (every 1s)
logs: true,
onQueueUpdate(update) {
setElapsedTime(Date.now() - start);
if (
update.status === 'IN_PROGRESS' ||
update.status === 'COMPLETED'
) {
setLogs((update.logs || []).map((log) => log.message));
}
},
});
const result: Result = await fal.subscribe(
'comfy/fal-ai/image-to-image',
{
input: {
prompt: prompt,
loadimage_1: imageFile,
},
pollInterval: 3000, // Default is 1000 (every 1s)
logs: true,
onQueueUpdate(update) {
setElapsedTime(Date.now() - start);
if (
update.status === 'IN_PROGRESS' ||
update.status === 'COMPLETED'
) {
setLogs((update.logs || []).map((log) => log.message));
}
},
}
);
setResult(getImageURL(result));
} catch (error: any) {
setError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import * as fal from '@fal-ai/serverless-client';
import { useMemo, useState } from 'react';
import getWorkflow from './workflow';

// @snippet:start(client.config)
fal.config({
Expand Down Expand Up @@ -80,22 +79,25 @@ export default function ComfyImageToVideoPage() {
setLoading(true);
const start = Date.now();
try {
const result: Result = await fal.subscribe('fal-ai/comfy-server', {
input: getWorkflow({
loadimage_1: imageFile,
}),
pollInterval: 3000, // Default is 1000 (every 1s)
logs: true,
onQueueUpdate(update) {
setElapsedTime(Date.now() - start);
if (
update.status === 'IN_PROGRESS' ||
update.status === 'COMPLETED'
) {
setLogs((update.logs || []).map((log) => log.message));
}
},
});
const result: Result = await fal.subscribe(
'comfy/fal-ai/image-to-video',
{
input: {
loadimage_1: imageFile,
},
pollInterval: 3000, // Default is 1000 (every 1s)
logs: true,
onQueueUpdate(update) {
setElapsedTime(Date.now() - start);
if (
update.status === 'IN_PROGRESS' ||
update.status === 'COMPLETED'
) {
setLogs((update.logs || []).map((log) => log.message));
}
},
}
);
setResult(getImageURL(result));
} catch (error: any) {
setError(error);
Expand Down
102 changes: 0 additions & 102 deletions apps/demo-nextjs-app-router/app/comfy/image_to_image/workflow.tsx

This file was deleted.

91 changes: 0 additions & 91 deletions apps/demo-nextjs-app-router/app/comfy/image_to_video/workflow.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions apps/demo-nextjs-app-router/app/comfy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ export default function Index() {
</p>
<div className="mt-12 grid grid-cols-1 gap-3 md:grid-cols-3 lg:grid-cols-3">
<button
onClick={() => router.push('/comfy/text_to_image')}
onClick={() => router.push('/comfy/text-to-image')}
className="px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white rounded-lg shadow-md transition-transform transform hover:-translate-y-1"
>
Text to Image
</button>
<button
onClick={() => router.push('/comfy/image_to_image')}
onClick={() => router.push('/comfy/image-to-image')}
className="px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white rounded-lg shadow-md transition-transform transform hover:-translate-y-1"
>
Image to Image
</button>
<button
onClick={() => router.push('/comfy/image_to_video')}
onClick={() => router.push('/comfy/image-to-video')}
className="px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white rounded-lg shadow-md transition-transform transform hover:-translate-y-1"
>
Image to Video
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import * as fal from '@fal-ai/serverless-client';
import { useMemo, useState } from 'react';
import getWorkflow from './workflow';

// @snippet:start(client.config)
fal.config({
Expand Down Expand Up @@ -83,10 +82,10 @@ export default function ComfyTextToImagePage() {
setLoading(true);
const start = Date.now();
try {
const result: Result = await fal.subscribe('fal-ai/comfy-server', {
input: getWorkflow({
const result: Result = await fal.subscribe('comfy/fal-ai/text-to-image', {
input: {
prompt: prompt,
}),
},
pollInterval: 3000, // Default is 1000 (every 1s)
logs: true,
onQueueUpdate(update) {
Expand Down
Loading
Loading