Skip to content

Instantly share code, notes, and snippets.

"use client";
import { motion } from "motion/react";
import { useState, useRef, useEffect } from "react";
import { cn } from "@/lib/utils";
const tabs = [
{
id: 0,
@andrewlu0
andrewlu0 / example.tsx
Last active April 24, 2023 21:26
Baseplate Image example
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline";
import Image from "next/image";
// .. component code here
// search_results is the last message if you are using streaming, otherwise its included in the API response
{search_results
?.slice(0, 2)
.map((result: any) =>
result.image_paths
? Object.values(result.image_paths)?.map(
@andrewlu0
andrewlu0 / upload.py
Last active April 3, 2023 21:08
Upload to Baseplate
import requests
import io
url = "https://app.baseplate.ai/api/datasets/$DATASET_ID/upload"
response = requests.get("https://jsonplaceholder.typicode.com/todos/1")
response.raise_for_status()
payload={'chunk_size': '700',
'chunk_overlap': '100',
'document_id': 'test_document'}
file_like_object = io.BytesIO(response.content)
@andrewlu0
andrewlu0 / upload.py
Last active April 3, 2023 21:08
Upload File to Baseplate (Python)
import requests
url = "https://app.baseplate.ai/api/datasets/$DATASET_ID/upload"
payload={'chunk_size': '700',
'chunk_overlap': '100',
'document_id': '$DOC_ID'}
files=[
('file',('file.txt',open('file.txt','rb'),'application/text'))
]