13 const content = lastMsg?.content?.trim();
14 if (!url) {
15 yield "Please send a image";
16 yield events.done();
17 }
18
19 yield events.replace("Generating image");
20 let success = null;
21 let error = null;
22 replicate.run("jagilley/controlnet-scribble:435061a1b5a4c1e26740464bf786efdfa9cb3a3ac488595a2de23e143fdb0117", {
23 input: {
24 image: url,
25 prompt: content || "photorealistic",
26 },
35 while (!success && !error) {
36 console.log("waiting", success, error);
37 yield events.replace(`Generating image (${seconds++} seconds)`);
38 await sleep(1000);
39 if (seconds > 30) {
51 } else {
52 console.log("success!", success);
53 yield events.replace(`\n\n`);
54 yield "\n";
55 }
13 const content = lastMsg?.content?.trim();
14 if (!url) {
15 yield "Please send a image";
16 yield events.done();
17 }
18
19 yield events.replace("Generating image");
20 let success = null;
21 let error = null;
22 replicate.run("jagilley/controlnet-scribble:435061a1b5a4c1e26740464bf786efdfa9cb3a3ac488595a2de23e143fdb0117", {
23 input: {
24 image: url,
25 prompt: content || "photorealistic",
26 },
35 while (!success && !error) {
36 console.log("waiting", success, error);
37 yield events.replace(`Generating image (${seconds++} seconds)`);
38 await sleep(1000);
39 if (seconds > 30) {
51 } else {
52 console.log("success!", success);
53 yield events.replace(`\n\n`);
54 yield "\n";
55 }
16};
17
18type ImageData = {
19 type: "image";
20 text: string;
21 name?: string | undefined;
48};
49
50export type Data = BooleanData | TextData | ImageData | SpeechData | WebsiteData | FileData;
51
52type DataComponentRequestBody = {
16};
17
18type ImageData = {
19 type: "image";
20 text: string;
21 name?: string | undefined;
40};
41
42export type Data = BooleanData | TextData | ImageData | SpeechData | WebsiteData;
43
44export default async function(req: Request): Promise<Response> {
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5
6
7Versions 0-17 of this val were done with Hono and server-rendering.
440 {profile && (
441 <div className="flex items-center space-x-4">
442 <img src={profile.profileImageUrl} alt="Profile" className="w-8 h-8 rounded-full" />
443 <span>{profile.username}</span>
444 <a href="/auth/logout" className="text-blue-400 hover:text-blue-300">Logout</a>
583 alt="Blob content"
584 className="max-w-full h-auto"
585 onError={() => console.error("Error loading image")}
586 />
587 </div>
635 <li>Create public shareable links for blobs</li>
636 <li>View and manage public folder</li>
637 <li>Preview images directly in the interface</li>
638 </ul>
639 </div>
694 const { ValTown } = await import("npm:@valtown/sdk");
695 const vt = new ValTown();
696 const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
697 // const authorEmail = me.email;
698
762
763 c.set("email", email);
764 c.set("profile", { profileImageUrl, username });
765 await next();
766};
2
3const basePrompt =
4 `Generate an image generation model prompt (description) for the previous image, in Barbie or Ken toy style
5 Be extremely detailed in describing:
6 - Hair color
15 - Lighting and shadows
16 - Any props or accessories
17 The final result should result in a image of barbie figures that look like the original.
18 Output only the prompt and nothing else.`;
19
20const settings = {
21 text_bot: "gpt-4o",
22 image_bot: "FLUX-pro-1.1",
23};
24
31 const url = new URL(httpReq.url);
32
33 const imageDescriptionPrompt = basePrompt;
34
35 if (!imgUrl) {
36 yield "Please upload a image";
37 yield events.done();
38 }
39 let baseStatus = "Analyzing image";
40
41 const msgToForward = { ...req.query.at(-1) };
42 msgToForward.content = "Describe the contents of this image";
43
44 msgToForward.content = imageDescriptionPrompt;
45 const query = {
46 ...req,
47 query: [{
48 ...lastMsg,
49 content: imageDescriptionPrompt,
50 role: "user",
51 attachments: lastMsg?.attachments,
59 let text = "";
60 console.log("sending to gpt4o", query);
61 yield `Analyzing image...`;
62 for await (const msg of gpt4oQuery) {
63 if (msg.event == "text") {
73 }
74
75 const imageQuery = {
76 ...req,
77 query: [{
80 }],
81 };
82 const imageStream = forward({
83 toBotName: settings.image_bot,
84 query: imageQuery,
85 accessKey: req.access_key,
86 });
87 for await (const msg of imageStream) {
88 yield msg;
89 }
95 server_bot_dependencies: {
96 [settings.text_bot]: 1,
97 [settings.image_bot]: 1,
98 },
99 introduction_message: "Send me a picture and I will make it cartoon like.",
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169
2
3const basePrompt =
4 `Generate an image generation model prompt (description) for the previous image, in Barbie or Ken toy style
5 Be extremely detailed in describing:
6 - Hair color
15 - Lighting and shadows
16 - Any props or accessories
17 The final result should result in a image of barbie figures that look like the original.
18 Output only the prompt and nothing else.`;
19
20const settings = {
21 text_bot: "gpt-4o",
22 image_bot: "FLUX-pro-1.1",
23};
24
31 const url = new URL(httpReq.url);
32
33 const imageDescriptionPrompt = basePrompt;
34
35 if (!imgUrl) {
36 yield "Please upload a image";
37 yield events.done();
38 }
39 let baseStatus = "Analyzing image";
40
41 const msgToForward = { ...req.query.at(-1) };
42 msgToForward.content = "Describe the contents of this image";
43
44 msgToForward.content = imageDescriptionPrompt;
45 const query = {
46 ...req,
47 query: [{
48 ...lastMsg,
49 content: imageDescriptionPrompt,
50 role: "user",
51 attachments: lastMsg?.attachments,
59 let text = "";
60 console.log("sending to gpt4o", query);
61 yield `Analyzing image...`;
62 for await (const msg of gpt4oQuery) {
63 if (msg.event == "text") {
73 }
74
75 const imageQuery = {
76 ...req,
77 query: [{
80 }],
81 };
82 const imageStream = forward({
83 toBotName: settings.image_bot,
84 query: imageQuery,
85 accessKey: req.access_key,
86 });
87 for await (const msg of imageStream) {
88 yield msg;
89 }
95 server_bot_dependencies: {
96 [settings.text_bot]: 1,
97 [settings.image_bot]: 1,
98 },
99 introduction_message: "Send me a picture and I will make it cartoon like.",
2
3const basePrompt =
4 `Generate an image generation model prompt (description) for the previous image, in Barbie or Ken toy style
5 Be extremely detailed in describing:
6 - Hair color
15 - Lighting and shadows
16 - Any props or accessories
17 The final result should result in a image of barbie figures that look like the original.
18 Output only the prompt and nothing else.`;
19
20const settings = {
21 text_bot: "gpt-4o",
22 image_bot: "FLUX-pro-1.1",
23};
24
31 const url = new URL(httpReq.url);
32
33 const imageDescriptionPrompt = basePrompt;
34
35 if (!imgUrl) {
36 yield "Please upload a image";
37 yield events.done();
38 }
39 let baseStatus = "Analyzing image";
40
41 const msgToForward = { ...req.query.at(-1) };
42 msgToForward.content = "Describe the contents of this image";
43
44 msgToForward.content = imageDescriptionPrompt;
45 const query = {
46 ...req,
47 query: [{
48 ...lastMsg,
49 content: imageDescriptionPrompt,
50 role: "user",
51 attachments: lastMsg?.attachments,
59 let text = "";
60 console.log("sending to gpt4o", query);
61 yield `Analyzing image...`;
62 for await (const msg of gpt4oQuery) {
63 if (msg.event == "text") {
73 }
74
75 const imageQuery = {
76 ...req,
77 query: [{
80 }],
81 };
82 const imageStream = forward({
83 toBotName: settings.image_bot,
84 query: imageQuery,
85 accessKey: req.access_key,
86 });
87 for await (const msg of imageStream) {
88 yield msg;
89 }
95 server_bot_dependencies: {
96 [settings.text_bot]: 1,
97 [settings.image_bot]: 1,
98 },
99 introduction_message: "Send me a picture and I will make it cartoon like.",