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 2 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
38 changes: 20 additions & 18 deletions apps/demo-nextjs-app-router/app/comfy/image_to_image/page.tsx
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
102 changes: 0 additions & 102 deletions apps/demo-nextjs-app-router/app/comfy/image_to_image/workflow.tsx

This file was deleted.

36 changes: 19 additions & 17 deletions apps/demo-nextjs-app-router/app/comfy/image_to_video/page.tsx
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
91 changes: 0 additions & 91 deletions apps/demo-nextjs-app-router/app/comfy/image_to_video/workflow.tsx

This file was deleted.

7 changes: 3 additions & 4 deletions apps/demo-nextjs-app-router/app/comfy/text_to_image/page.tsx
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