Versions

  • v29

    7/10/2024
    Open: Version
    Changes from v28 to v29
    +0
    -0
    ⦚ 56 unchanged lines ⦚
    ⦚ 56 unchanged lines ⦚
  • v28

    7/10/2024
    Open: Version
    Changes from v27 to v28
    +1
    -1
    ⦚ 39 unchanged lines ⦚
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "1200px" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    ⦚ 12 unchanged lines ⦚
    ⦚ 39 unchanged lines ⦚
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", width: "1200px" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    ⦚ 12 unchanged lines ⦚
  • v27

    7/10/2024
    Open: Version
    Changes from v26 to v27
    +1
    -1
    ⦚ 39 unchanged lines ⦚
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "80%" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    ⦚ 12 unchanged lines ⦚
    ⦚ 39 unchanged lines ⦚
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "1200px" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    ⦚ 12 unchanged lines ⦚
  • v26

    7/10/2024
    Open: Version
    Changes from v25 to v26
    +15
    -6
    ⦚ 3 unchanged lines ⦚
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    async function getResults(q: string, n: number) {
    const substrate = new Substrate({
    apiKey: process.env.SUBSTRATE_API_KEY,
    ⦚ 10 unchanged lines ⦚
    const res = await substrate.run(query);
    console.log(q, res.get(query).results[0]);
    return res.get(query).results[0];
    }

    export default async (req: Request) => {
    const searchParams = new URL(req.url).searchParams;
    const { prompt = "tarantino", n = 12 } = Object.fromEntries(searchParams);
    const res = await getResults(prompt, Number(n));
    const uris = res.map(r => r.metadata.doc);
    return new Response(
    renderToString(
    ⦚ 3 unchanged lines ⦚
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
    <div key={u} style={{ padding: "10px" }}>
    <img src={u} style={{ width: "100%" }} />
    </div>
    ))}
    ⦚ 7 unchanged lines ⦚
    ⦚ 3 unchanged lines ⦚
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    type ShotResult = {
    id: string;
    distance: number;
    metadata: {
    doc: string; // base64 img data
    doc_id: string;
    };
    };

    async function getResults(q: string, n: number): Promise<ShotResult[]> {
    const substrate = new Substrate({
    apiKey: process.env.SUBSTRATE_API_KEY,
    ⦚ 10 unchanged lines ⦚
    const res = await substrate.run(query);
    console.log(q, res.get(query).results[0]);
    return res.get(query).results[0] as ShotResult[];
    }

    export default async (req: Request) => {
    const searchParams = new URL(req.url).searchParams;
    const { prompt = "tarantino", n = 12 } = Object.fromEntries(searchParams);
    const res = await getResults(prompt, Number(n));

    return new Response(
    renderToString(
    ⦚ 3 unchanged lines ⦚
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {res.map(s => (
    <div key={s.id} style={{ padding: "10px" }}>
  • v25

    7/10/2024
    Open: Version
    Changes from v24 to v25
    +14
    -52
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { useState } from "npm:react";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    ⦚ 16 unchanged lines ⦚
    }

    const App = ({ uris }) => {
    const [fullScreenImage, setFullScreenImage] = useState(null);

    const handleClick = (uri) => {
    console.log("click", uri);
    setFullScreenImage(uri);
    };

    const handleOverlayClick = () => {
    setFullScreenImage(null);
    };

    return (
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <body>
    <main style={{ padding: "20px" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
    <div key={u} style={{ padding: "10px" }} onClick={() => handleClick(u)}>
    <img src={u} style={{ width: "100%", cursor: "pointer" }} />
    </div>
    ))}
    </div>
    {fullScreenImage && (
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    ⦚ 16 unchanged lines ⦚
    }

    export default async (req: Request) => {
    const searchParams = new URL(req.url).searchParams;
    const { prompt = "tarantino", n = 12 } = Object.fromEntries(searchParams);
    const res = await getResults(prompt, Number(n));
    const uris = res.map(r => r.metadata.doc);
    return new Response(
    renderToString(
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "80%" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
    <div key={u} style={{ padding: "10px" }}>
    <img src={u} style={{ width: "100%" }} />
    </div>
    ))}
    </div>
    </main>
    </html>,
    ),
    { headers: { "Content-Type": "text/html" } },
    );
    };
  • v24

    7/10/2024
    Open: Version
    Changes from v23 to v24
    +1
    -0
    ⦚ 26 unchanged lines ⦚

    const handleClick = (uri) => {
    setFullScreenImage(uri);
    };

    ⦚ 53 unchanged lines ⦚
    ⦚ 26 unchanged lines ⦚

    const handleClick = (uri) => {
    console.log("click", uri);
    setFullScreenImage(uri);
    };

    ⦚ 53 unchanged lines ⦚
  • v23

    7/10/2024
    Open: Version
    Changes from v22 to v23
    +1
    -1
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";
    import { useState } from "react";

    async function getResults(q: string, n: number) {
    ⦚ 77 unchanged lines ⦚
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { useState } from "npm:react";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    async function getResults(q: string, n: number) {
    ⦚ 77 unchanged lines ⦚
  • v22

    7/10/2024
    Open: Version
    Changes from v21 to v22
    +51
    -14
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    async function getResults(q: string, n: number) {
    ⦚ 15 unchanged lines ⦚
    }

    export default async (req: Request) => {
    const searchParams = new URL(req.url).searchParams;
    const { prompt = "tarantino", n = 12 } = Object.fromEntries(searchParams);
    const res = await getResults(prompt, Number(n));
    const uris = res.map(r => r.metadata.doc);
    return new Response(
    renderToString(
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "80%" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
    <div key={u} style={{ padding: "10px" }}>
    <img src={u} style={{ width: "100%" }} />
    </div>
    ))}
    </div>
    </main>
    </html>,
    ),
    { headers: { "Content-Type": "text/html" } },
    );
    };
    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";
    import { useState } from "react";

    async function getResults(q: string, n: number) {
    ⦚ 15 unchanged lines ⦚
    }

    const App = ({ uris }) => {
    const [fullScreenImage, setFullScreenImage] = useState(null);

    const handleClick = (uri) => {
    setFullScreenImage(uri);
    };

    const handleOverlayClick = () => {
    setFullScreenImage(null);
    };

    return (
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <body>
    <main style={{ padding: "20px" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
    <div key={u} style={{ padding: "10px" }} onClick={() => handleClick(u)}>
    <img src={u} style={{ width: "100%", cursor: "pointer" }} />
    </div>
    ))}
    </div>
    {fullScreenImage && (
  • v21

    7/10/2024
    Open: Version
    +47
    -0

    /** @jsxImportSource npm:react **/
    import process from "node:process";
    import { renderToString } from "npm:react-dom@18/server";
    import { QueryVectorStore, sb, Substrate } from "npm:substrate";

    async function getResults(q: string, n: number) {
    const substrate = new Substrate({
    apiKey: process.env.SUBSTRATE_API_KEY,
    });
    const collectionName = "shotclip";

    const query = new QueryVectorStore({
    collection_name: collectionName,
    model: "clip",
    query_strings: [q],
    include_metadata: true,
    top_k: n,
    });
    const res = await substrate.run(query);
    console.log(q, res.get(query).results[0]);
    return res.get(query).results[0];
    }

    export default async (req: Request) => {
    const searchParams = new URL(req.url).searchParams;
    const { prompt = "tarantino", n = 12 } = Object.fromEntries(searchParams);
    const res = await getResults(prompt, Number(n));
    const uris = res.map(r => r.metadata.doc);
    return new Response(
    renderToString(
    <html>
    <link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
    <main style={{ padding: "20px", maxWidth: "80%" }}>
    <h1>Shotclip</h1>
    <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: "10px", paddingTop: "20px" }}>
    {uris.map(u => (
kousun12-shotclip.web.val.run
Updated: July 10, 2024