Search

Results include substring matches and semantically similar vals. Learn more
vlad avatar
tempsimplegptexample
@vlad
// Example of action that doesn't accept any input, but returns something
HTTP
* INITIALIZE API
const api = new GptApi({
url: "https://vlad-tempsimplegptexample.web.val.run",
title: "Some API",
description: "API for something",
version: "1.0.0",
// Example of action that doesn't accept any input, but returns something
const ResponseCommandSchema = z.object({
feedback: z.string().describe("Feedback regarding submitted action"),
data: z.string().optional().describe("Additional data related to the given command"),
tmcw avatar
arenaApiExample
@tmcw
Are.na API Example of using the are.na API to get the contents of an Are.na board - specifically my fun board that showcases websites with that "glossy black style." All you need is fetch to make this happen!
Script
# Are.na API
Example of using the [are.na](https://dev.are.na/documentation/channels#Block43472) API to get the contents of an Are.na boar
All you need is [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to make this happen!
import { fetch } from "https://esm.town/v/std/fetch";
export let arenaApiExample = (async () => {
const resp = await fetch(
"http://api.are.na/v2/channels/that-glassy-dark-design-style",
const json = await resp.json();
return json;
stevekrouse avatar
oak_demo
@stevekrouse
Oak Server Example
HTTP
# Oak Server Example
import { Application } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
app.use((ctx) => {
ctx.response.body = "Hello Val Town!";
export default app.fetch;
nbbaier avatar
logicalTealPelican
@nbbaier
An interactive, runnable TypeScript val by nbbaier
HTTP
const app = new Hono();
const schema = type({
name: "string",
age: "number",
app.get("/", c => c.text("hono"));
app.post("/", arktypeValidator("json", schema), (c) => {
const data = c.req.valid("json");
return c.json({
success: true,
message: `${data.name} is ${data.age}`,
nbbaier avatar
tanaSave
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
const token = Deno.env.get("tanaInputAPI");
export const tanaSave = async (req: Request) => {
const app = new Hono();
app.get("/save", async c => {
let { text, url } = c.req.query();
const payload: APIPlainNode = {
name: text,
children: [
{ name: "child 1" },
{ type: "field", attributeId: "cwi23sOzRSh8" },
jeffreyyoung avatar
apparentRedAphid
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
events,
forward,
PoeBotServerSentEvent,
QueryRequest,
sleep,
} from "https://esm.town/v/jeffreyyoung/poe_bot";
export default bot({
async *handleMessage(query, { req }) {
yield "<query>\n";
yield query.query.at(-1)?.content;
stevekrouse avatar
falSDXLExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP
import * as fal from "npm:@fal-ai/serverless-client";
fal.config({
// Can also be auto-configured using environment variables:
credentials: Deno.env.get("FAL_KEY"),
const prompt = "a cute and happy dog";
const result: any = await fal.run("fal-ai/fast-lightning-sdxl", { input: { prompt } });
export default () => html(`<img src="${result.images[0].url}" />`);
thedro avatar
myApi
@thedro
An interactive, runnable TypeScript val by thedro
Script
export const myApi = ((input) => {
var inner = (name) => {
return "hello " + name;
console.log(inner("What"));
console.log(inner);
return { inner, value: "one", output: inner("sup") };
// return async () => {
// inner(input);
yawnxyz avatar
ragwithclaude_ui
@yawnxyz
Wanted to build a UI for Simon's thing but he locked it lol
HTTP
Wanted to build a UI for Simon's thing but he locked it lol
/** @jsx jsx **/
// rag with claude ui
// https://simonw-ragwithclaude.web.val.run/?question=what%20is%20shot%20scraper
const app = new Hono();
const Page = () => (
<html lang="en">
<head>
<title>Simple HTMX Example</title>
<script src="https://unpkg.com/htmx.org@1.9.9"></script>
fal avatar
creative_upscaler
@fal
Creative Upscaler link to val - https://www.val.town/v/fal/creative_upscaler Usage const upscaledImage = @fal.creative_upscaler("an owl", "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png") Usage import fal from "npm:@fal-ai/serverless-client"; const result = await fal.subscribe("fal-ai/creative-upscaler", { input: { prompt: "an owl", image_url: "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png", }, logs: true, onQueueUpdate: (update) => { if (update.status === "IN_PROGRESS") { update.logs.map((log) => log.message).forEach(console.log); } }, }); https://www.fal.ai/models/creative-upscaler
Script
## Creative Upscaler
link to val - https://www.val.town/v/fal/creative_upscaler
### Usage
```js
const upscaledImage = @fal.creative_upscaler("an owl", "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.
### Usage
export let creativeUpscaler = async (
prompt: string,
image_url: string,
creativity: number = 0.5,
stevekrouse avatar
apiExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { runVal } from "https://esm.town/v/std/runVal";
export const apiExample = runVal("patrickjm.gpt3", {
prompt: "write me a limerick about sandboxing javascript",
impedivity avatar
honoTanaEndpoint
@impedivity
An interactive, runnable TypeScript val by impedivity
HTTP
const token = Deno.env.get("tanaInputAPI");
export const honoTanaEndpoint = async (req: Request) => {
const app = new Hono();
app.get("/", async (c) => {
let { text, url } = c.req.query();
console.log(c.req);
const payload: APIPlainNode = {
name: text,
children: [
// type: "field",
mattx avatar
examplebotendpoint
@mattx
An interactive, runnable TypeScript val by mattx
Express (deprecated)
export let examplebotendpoint = async (req: Request) => {
const headers = { "Content-type": "application/json" };
const text = await req.text();
const body = JSON.parse(text);
if (
!req.headers.get("X-Signature-Timestamp") ||
!req.headers.get("X-Signature-Ed25519")
return Response.json({ error: "bad request" }, { status: 400 });
const verified = await verify_discord_signature(
process.env.discord_pubkey,
yawnxyz avatar
audioManagerRunner
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
Script
import { AudioManager } from "https://esm.town/v/yawnxyz/audioManager";
let audio = new AudioManager();
let joke = await ai("tell me a joke about bacteriophages!");
console.log('text', joke)
let result = await audio.textToSpeechUpload(joke, {key: "random-joke.mp3"});
console.log('result:', result)
baiheinet avatar
nasaAPOD
@baiheinet
// Returns NASA's Astronomy Picture of the Day (APOD)
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
// Returns NASA's Astronomy Picture of the Day (APOD)
export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
// Forked from @iBrokeit.nasaAPOD