blob_adminREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Use this button to install the val:
umbrellaReminderREADME.md1 match
1# ☔️ Umbrella reminder if there's rain today
23
45## Setup
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.
1112<img width=500 src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/7077d1b5-1fa7-4a9b-4b93-f8d01d3e4f00/public"/>
2* This program creates an HTTP server that fetches various data from NASA APIs
3* and returns a JSON response with a collection of interesting information about today.
4* It uses multiple NASA APIs to gather diverse space-related data, including real-time imagery
5* and additional interesting data points.
6*/
17const apodData = await apodResponse.json();
1819// Fetch latest EPIC image metadata
20const epicResponse = await fetch(`https://api.nasa.gov/EPIC/api/natural?api_key=${NASA_API_KEY}`);
21const epicData = await epicResponse.json();
22const latestEpicImage = epicData[0];
2324// Fetch Near Earth Objects for today
38const issData = await issResponse.json();
3940// Fetch NASA Image and Video Library data
41const nasaLibraryResponse = await fetch(`https://images-api.nasa.gov/search?q=space&media_type=image`);
42const nasaLibraryData = await nasaLibraryResponse.json();
4355},
56earthPolychromaticImagingCamera: {
57date: latestEpicImage.date,
58caption: latestEpicImage.caption,
59imageUrl: `https://epic.gsfc.nasa.gov/archive/natural/${latestEpicImage.date.split(' ')[0].replace(/-/g, '/')}/png/${latestEpicImage.image}.png`,
60},
61nearEarthObjects: {
85timestamp: new Date(issData.timestamp * 1000).toISOString()
86},
87nasaImageLibrary: {
88recentImages: nasaLibraryData.collection.items.slice(0, 5).map(item => ({
89title: item.data[0].title,
90description: item.data[0].description,
FindFraudTrendsUsingGPTREADME.md2 matches
21With some variable renaming, and rewriting of the prompt, this should produce very accurate data analytic reports for any data provided.
2223
24
2526
frameHtmlRawmain.tsx5 matches
17<meta property="of:accepts:xmtp" content="2024-02-09" />
18
19<meta property="fc:frame:image" content="${prefixUrl(frame.image)}" />
20<meta property="of:image" content="${prefixUrl(frame.image)}" />
21<meta property="og:image" content="${prefixUrl(frame.image)}" />
22
23<meta property="fc:frame:image:aspect_ratio" content="${aspectRatio}" />
24<meta property="of:image:aspect_ratio" content="${aspectRatio}" />
25
26${buttonsHtml}
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
egoBoostermain.tsx15 matches
2* This ego booster app takes a selfie, sends it to GPT-4o-mini for analysis,
3* and streams funny, specific compliments about the user's appearance.
4* We use the WebRTC API for camera access, the OpenAI API for image analysis,
5* and server-sent events for real-time streaming of compliments.
6*/
73const context = canvasRef.current.getContext('2d');
74if (context) {
75context.drawImage(videoRef.current, 0, 0, canvasRef.current.width, canvasRef.current.height);
76console.log("Selfie captured on canvas");
77try {
78const blob = await new Promise<Blob | null>((resolve) => canvasRef.current!.toBlob(resolve, 'image/jpeg'));
79if (blob) {
80console.log("Blob created, size:", blob.size);
81const formData = new FormData();
82formData.append('image', blob, 'selfie.jpg');
83
84console.log("Sending request to /analyze");
112} else {
113console.log("Failed to create blob");
114throw new Error("Failed to create image blob");
115}
116} catch (error) {
177console.log("Handling POST request to /analyze");
178const formData = await request.formData();
179const image = formData.get('image') as File;
180181if (!image) {
182console.log("No image provided in request");
183return new Response('No image provided', { status: 400 });
184} else {
185console.log("Image received, size:", image.size);
186}
187192async start(controller) {
193try {
194console.log("Starting to process image");
195const arrayBuffer = await image.arrayBuffer();
196const base64Image = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
197198console.log("Sending request to OpenAI");
202{
203role: "system",
204content: "You are a hilarious and overly enthusiastic ego booster. Your job is to provide 5 funny, specific, and over-the-top compliments about the person's appearance in the image. Be creative, exaggerate, and make it entertaining! Keep each compliment short and punchy, around 10-15 words max. Use lots of emojis and fun language. Respond in markdown format, with each compliment as a separate bullet point."
205},
206{
208content: [
209{ type: "text", text: "Analyze this selfie and give me 5 short, funny, specific compliments about my appearance:" },
210{ type: "image_url", image_url: { url: `data:image/jpeg;base64,${base64Image}` } }
211]
212}
password_authREADME.md1 match
3Protect your vals behind a password. Use session cookies to persist authentication.
45
67## Demo
218functions where possible. Unless specified, don't add error handling,
219make sure that errors bubble up to the caller.
220Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
221not practical for the user's request (e.g. if they ask for a particular animated gif).
222If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
280functions where possible. Unless specified, don't add error handling,
281make sure that errors bubble up to the caller.
282Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
283not practical for the user's request (e.g. if they ask for a particular animated gif).
284If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
315---
316
317Val Town comes with blob storage built-in. It allows for storing any data: text, JSON, images. You can access it via [\`std/blob\`](https://www.val.town/v/std/blob).
318
319Blob storage is scoped globally to your account. If you set a blob in one val, you can retrieve it by the same key in another val. It's backed by Cloudflare R2.