cerebras_codermain.tsx1 match
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
falDemoAppmain.tsx23 matches
7function App() {
8const [prompt, setPrompt] = useState("");
9const [imageUrl, setImageUrl] = useState("");
10const [loading, setLoading] = useState(false);
11const [imageSize, setImageSize] = useState("1152x2048");
1213const imageSizeOptions = [
14{ value: "1536x1024", label: "Landscape 4:3" },
15{ value: "1024x1024", label: "Square 1:1" },
17];
1819const generateImage = async (e?: React.FormEvent) => {
20e?.preventDefault();
21setLoading(true);
25});
2627const [width, height] = imageSize.split('x').map(Number);
2829const result = await fal.run("fal-ai/flux/schnell", {
33height,
34num_inference_steps: 4,
35num_images: 1,
36enable_safety_checker: true,
37sync_mode: true,
39});
40
41if (result.data && result.data.images && result.data.images.length > 0) {
42setImageUrl(result.data.images[0].url);
43} else {
44console.error("No images returned", result);
45alert("No image could be generated. Please try again.");
46}
47} catch (error) {
48console.error("Error generating image:", error);
49alert(`Image generation failed: ${error.message}`);
50} finally {
51setLoading(false);
56<div className="min-h-screen bg-black text-white py-12 px-4 sm:px-6 lg:px-8">
57<div className="max-w-3xl mx-auto">
58<h1 className="text-4xl font-bold text-center mb-8">Fal AI Image Generator</h1>
59<div className="bg-gray-900 rounded-lg p-6 mb-8 shadow-lg">
60<form className="flex flex-col sm:flex-row gap-4" onSubmit={generateImage}>
61<input
62type="text"
63value={prompt}
64onChange={(e) => setPrompt(e.target.value)}
65placeholder="Enter your image prompt"
66className="flex-grow px-4 py-2 bg-gray-800 border border-gray-700 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent"
67/>
68<select
69value={imageSize}
70onChange={(e) => setImageSize(e.target.value)}
71className="px-4 py-2 bg-gray-800 border border-gray-700 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent"
72>
73{imageSizeOptions.map((option) => (
74<option key={option.value} value={option.value}>
75{option.label}
78</select>
79<button
80onClick={generateImage}
81disabled={loading || !prompt}
82className={`px-6 py-2 rounded-md text-white font-medium transition-colors duration-200 ${
108)
109: (
110"Generate Image"
111)}
112</button>
113</form>
114</div>
115{imageUrl && (
116<div className="bg-gray-900 rounded-lg overflow-hidden shadow-lg">
117<img src={imageUrl} alt="Generated image" className="w-full h-auto" />
118</div>
119)}
146<meta charset="UTF-8">
147<meta name="viewport" content="width=device-width, initial-scale=1.0">
148<title>Fal AI Image Generator</title>
149<script src="https://cdn.tailwindcss.com"></script>
150<style>
swiftEmeraldAphidmain.tsx1 match
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
sqliteExplorerAppREADME.md1 match
3View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stevekrouse/sqlite_admin?v=46) val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by [LibSQL Studio](https://github.com/invisal/libsql-studio) by [invisal](https://github.com/invisal). This is now more an SPA, with tables, queries and results showing up on the same page.
45
67## Install
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
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
password_authREADME.md1 match
3Protect your vals behind a password. Use session cookies to persist authentication.
45
67## Usage
cerebras_codermain.tsx32 matches
8const [tackleBox, setTackleBox] = useState([]);
9const [recommendation, setRecommendation] = useState("");
10const [lureImageUrl, setLureImageUrl] = useState("");
1112useEffect(() => {
159const lureName = event.target.elements["lure-name"].value;
160const lureDescription = event.target.elements["lure-description"].value;
161const lureImage = event.target.elements["lure-image"].files[0];
162const lureImageUrlInput = event.target.elements["lure-image-url"].value;
163164let imageUrl = "";
165if (lureImage) {
166const formData = new FormData();
167formData.append("image", lureImage);
168try {
169const response = await fetch("/api/uploadImage", {
170method: "POST",
171body: formData,
173if (response.ok) {
174const data = await response.json();
175imageUrl = data.url;
176}
177} catch (error) {
178console.error("Error uploading image:", error);
179}
180} else if (lureImageUrlInput) {
181imageUrl = lureImageUrlInput;
182}
183184const newLure = { name: lureName, description: lureDescription, image: imageUrl };
185
186try {
195setTackleBox([...tackleBox, newLure]);
196event.target.reset();
197setLureImageUrl("");
198}
199} catch (error) {
302</div>
303<div className="mb-4">
304<label className="block text-gray-700" htmlFor="lure-image">Upload Lure/Fly Image (Optional)</label>
305<input className="w-full p-2 border border-gray-300 rounded" id="lure-image" name="lure-image" type="file" accept="image/*" />
306</div>
307<div className="mb-4">
308<label className="block text-gray-700" htmlFor="lure-image-url">Or Enter Image URL</label>
309<input
310className="w-full p-2 border border-gray-300 rounded"
311id="lure-image-url"
312name="lure-image-url"
313type="url"
314placeholder="https://example.com/image.jpg"
315value={lureImageUrl}
316onChange={(e) => setLureImageUrl(e.target.value)}
317/>
318</div>
319{lureImageUrl && (
320<div className="mb-4">
321<img src={lureImageUrl} alt="Lure preview" className="max-w-full h-auto" />
322</div>
323)}
330{tackleBox.map((lure, index) => (
331<div key={index} className="border p-4 rounded">
332{lure.image && <img src={lure.image} alt={lure.name} className="w-full h-40 object-cover mb-2 rounded" />}
333<h3 className="text-lg font-bold">{lure.name}</h3>
334<p className="text-gray-700">{lure.description}</p>
377});
378}
379} else if (url.pathname === "/api/uploadImage") {
380if (req.method === "POST") {
381const formData = await req.formData();
382const image = formData.get("image") as File;
383if (image) {
384const imageBuffer = await image.arrayBuffer();
385const imageKey = `${key}_image_${Date.now()}_${image.name}`;
386await blob.set(imageKey, imageBuffer);
387const imageUrl = `https://val.town/v1/blob/${imageKey}`;
388return new Response(JSON.stringify({ url: imageUrl }), {
389headers: { "Content-Type": "application/json" },
390});
idealJadeGerbilmain.tsx1 match
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
tolerantCyanCrawdadmain.tsx1 match
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