Runs every 15 min
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/** @jsxImportSource https://esm.sh/react */
import fal from "npm:@fal-ai/serverless-client";
import { renderToString } from "npm:react-dom/server";
export default async function(interval: Interval) {
const result = await fal.subscribe("fal-ai/supir", {
input: {
image_url: "https://storage.googleapis.com/falserverless/gallery/NOCA_Mick-Thompson.resized.resized.jpg",
},
logs: true,
onQueueUpdate: (update) => {
if (update.status === "IN_PROGRESS") {
update.logs.map((log) => log.message).forEach(console.log);
}
},
});
console.log(result.image.url);
console.log(
renderToString(
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>gorkem</h1>
<img src={result.image.url} />
</body>
</html>,
),
{
headers: { "Content-Type": "text/html" },
},
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
v47
March 18, 2024