medicineLabelAnalyzerAppmain.tsx23 matches
45function App() {
6const [image, setImage] = useState<File | null>(null);
7const [analysis, setAnalysis] = useState<string | null>(null);
8const [isLoading, setIsLoading] = useState(false);
910const handleImageUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
11const file = e.target.files?.[0];
12if (file) {
13setImage(file);
14}
15};
1617const processImage = async () => {
18if (!image) return;
1920setIsLoading(true);
21const formData = new FormData();
22formData.append('image', image);
2324try {
31} catch (error) {
32console.error('Analysis failed', error);
33setAnalysis('Failed to analyze the image. Please try again.');
34} finally {
35setIsLoading(false);
47<input
48type="file"
49accept="image/*"
50onChange={handleImageUpload}
51style={{ marginBottom: '10px' }}
52/>
53<button
54onClick={processImage}
55disabled={!image || isLoading}
56style={{
57backgroundColor: image ? '#4CAF50' : '#cccccc',
58color: 'white',
59padding: '10px 15px',
60border: 'none',
61borderRadius: '5px',
62cursor: image ? 'pointer' : 'not-allowed'
63}}
64>
105try {
106const formData = await request.formData();
107const imageFile = formData.get('image') as File;
108
109if (!imageFile) {
110return new Response('No image uploaded', { status: 400 });
111}
112113const imageBytes = await imageFile.arrayBuffer();
114const base64Image = btoa(
115String.fromCharCode(...new Uint8Array(imageBytes))
116);
117139},
140{
141type: "image_url",
142image_url: { url: `data:image/jpeg;base64,${base64Image}` }
143}
144]
149150const analysis = completion.choices[0].message.content ||
151"Unable to generate analysis from the image.";
152153return new Response(analysis, {
157} catch (error) {
158console.error('Analysis error:', error);
159return new Response('Error processing image', { status: 500 });
160}
161}
cerebras_codermain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
bedtimeStoryMakermain.tsx8 matches
104role: "system",
105content:
106`Describe an image that depicts the ${adjective} children's story about a ${color} colored ${animal}: ${summary}.
107The description should be descriptive, but three short sentences.
108Just give me the instructions, don't make an image.`,
109},
110],
123// fast-lightning-sdxl
124const options = {
125"image_size": "square",
126"num_images": 1,
127"num_inference_steps": 6,
128"enable_safety_checker": true,
129}
130// {"num_images": 1,
131// "guidance_scale": 9.5,
132// "num_inference_steps": 20,
133// "expand_prompt": true }
134const result: any = await fal.run(`fal-ai/${falModel}`, { input: { prompt }, options })
135const url = result.images[0].url
136137return url
142title: ogData?.title || "Bedtime Story Maker",
143description: ogData?.description || "",
144image: ogData?.image || "",
145url: ogData?.url || `https://dthyresson-bedtimestorymaker.web.val.run/bedtime_stories}`,
146}
461title,
462description: summary,
463image: pictureUrl,
464url: `https://dthyresson-bedtimestorymaker.web.val.run/bedtime_stories/read/${id}`,
465}
bedtimeStoryMakerREADME.md3 matches
234
56Inspired from a RedwoodJS demo I mde last year, this adds generative art powered by Fal to the bedtime story maker.
21for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave".
2223Then using the summary, OpenAI geenrates another prompt to describe the instructions to geneate a childrens story book image.
2425That's sent to Fal to generate an image.
2627Stories get saved to `bedtime_stories` in SQLite for viewing, searching and maybe sharing.
cerebras_codermain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
fastPlumBonobomain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
observantBronzeOrcamain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
cerebras_codermain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
cerebras_codermain.tsx1 match
1185<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."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
instagramExtractmain.tsx23 matches
6const [url, setUrl] = useState("");
7const [resultCaption, setResultText] = useState("");
8const [resultImage, setResultImage] = useState("");
9const [copyStatus, setCopyStatus] = useState("");
10const imageRef = useRef(null);
11const textRef = useRef(null);
1218console.log(data);
19setResultText(`Reposted from @${data.username}\n\n${data.caption}`);
20setResultImage(data.imageUrl);
21})
22.catch((error) => {
23console.error("Error fetching data:", error);
24setResultText("Error fetching data");
25setResultImage("");
26});
27}
45<div style={{ maxWidth: "600px", margin: "0 auto", padding: "20px" }}>
46<h1>Instagram Extracter</h1>
47<h2>Extract images from single-image instagram posts</h2>
4849<div>
50<label>
51{(resultImage && resultCaption)
52? "Post URL"
53: "Enter the URL to the Post"}
60/>
6162{!(resultImage && resultCaption) && (
63<p style={{ marginBottom: "10px" }}>
64Click the share button at the bottom left of post (the paper
68</div>
6970{resultImage && resultCaption && (
71<>
72{copyStatus && (
96<div style={{ marginTop: "20px" }}>
97<img
98ref={imageRef}
99src={resultImage}
100alt="Result"
101style={{ maxWidth: "100%", border: "1px solid #ccc" }}
102/>
103Click and hold, then click save image.
104</div>
105</div>
134135try {
136const { caption, username, imageUrl } = await instagramPostExtract(
137instagramUrl,
138);
139console.log(imageUrl);
140141// If the 'image' parameter is present, proxy the image
142if (url.searchParams.get("image") === "true") {
143const imageResponse = await fetch(imageUrl);
144return new Response(imageResponse.body, {
145headers: {
146"Content-Type": imageResponse.headers.get("Content-Type") ||
147"image/jpeg",
148"Cache-Control": "public, max-age=3600", // Cache for 1 hour
149},
151}
152153// Otherwise, return JSON with caption and proxied image URL
154const proxiedImageUrl = `${url.origin}/extract?url=${
155encodeURIComponent(instagramUrl)
156}&image=true`;
157return new Response(
158JSON.stringify({ caption, imageUrl: proxiedImageUrl, username }),
159{
160headers: { "Content-Type": "application/json" },