Spaces:
Runtime error
Runtime error
Upload 16 files
Browse files- .eslintrc.json +3 -0
- .gitignore +40 -0
- Dockerfile +19 -0
- app/favicon.ico +0 -0
- app/globals.css +107 -0
- app/layout.js +17 -0
- app/page.js +73 -0
- app/page.module.css +35 -0
- jsconfig.json +7 -0
- next.config.mjs +18 -0
- package-lock.json +0 -0
- package.json +20 -0
- pages/api/predictions/[id].js +20 -0
- pages/api/predictions/index.js +31 -0
- public/next.svg +1 -0
- public/vercel.svg +1 -0
.eslintrc.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extends": "next/core-web-vitals"
|
| 3 |
+
}
|
.gitignore
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
| 2 |
+
|
| 3 |
+
# custom
|
| 4 |
+
notes_nextjs.txt
|
| 5 |
+
.env.local
|
| 6 |
+
|
| 7 |
+
# dependencies
|
| 8 |
+
/node_modules
|
| 9 |
+
/.pnp
|
| 10 |
+
.pnp.js
|
| 11 |
+
.yarn/install-state.gz
|
| 12 |
+
|
| 13 |
+
# testing
|
| 14 |
+
/coverage
|
| 15 |
+
|
| 16 |
+
# next.js
|
| 17 |
+
/.next/
|
| 18 |
+
/out/
|
| 19 |
+
|
| 20 |
+
# production
|
| 21 |
+
/build
|
| 22 |
+
|
| 23 |
+
# misc
|
| 24 |
+
.DS_Store
|
| 25 |
+
*.pem
|
| 26 |
+
|
| 27 |
+
# debug
|
| 28 |
+
npm-debug.log*
|
| 29 |
+
yarn-debug.log*
|
| 30 |
+
yarn-error.log*
|
| 31 |
+
|
| 32 |
+
# local env files
|
| 33 |
+
.env*.local
|
| 34 |
+
|
| 35 |
+
# vercel
|
| 36 |
+
.vercel
|
| 37 |
+
|
| 38 |
+
# typescript
|
| 39 |
+
*.tsbuildinfo
|
| 40 |
+
next-env.d.ts
|
Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ==== CONFIGURE =====
|
| 2 |
+
# Use a Node 20 base image
|
| 3 |
+
FROM node:20
|
| 4 |
+
# Set the working directory to /code inside the container
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
# Copy app files
|
| 7 |
+
COPY . .
|
| 8 |
+
# ==== BUILD =====
|
| 9 |
+
# Install dependencies (npm ci makes sure the exact versions in the lockfile gets installed)
|
| 10 |
+
RUN npm ci
|
| 11 |
+
# Build the app
|
| 12 |
+
RUN npm run build
|
| 13 |
+
# ==== RUN =======
|
| 14 |
+
# Set the env to "production"
|
| 15 |
+
ENV NODE_ENV production
|
| 16 |
+
# Expose the port on which the app will be running (3000 is the default that `serve` uses)
|
| 17 |
+
EXPOSE 7860
|
| 18 |
+
# Start the app
|
| 19 |
+
CMD [ "npx", "serve", "-l", "7860", "build" ]
|
app/favicon.ico
ADDED
|
|
app/globals.css
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:root {
|
| 2 |
+
--max-width: 1100px;
|
| 3 |
+
--border-radius: 12px;
|
| 4 |
+
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
|
| 5 |
+
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
|
| 6 |
+
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
| 7 |
+
|
| 8 |
+
--foreground-rgb: 0, 0, 0;
|
| 9 |
+
--background-start-rgb: 214, 219, 220;
|
| 10 |
+
--background-end-rgb: 255, 255, 255;
|
| 11 |
+
|
| 12 |
+
--primary-glow: conic-gradient(
|
| 13 |
+
from 180deg at 50% 50%,
|
| 14 |
+
#16abff33 0deg,
|
| 15 |
+
#0885ff33 55deg,
|
| 16 |
+
#54d6ff33 120deg,
|
| 17 |
+
#0071ff33 160deg,
|
| 18 |
+
transparent 360deg
|
| 19 |
+
);
|
| 20 |
+
--secondary-glow: radial-gradient(
|
| 21 |
+
rgba(255, 255, 255, 1),
|
| 22 |
+
rgba(255, 255, 255, 0)
|
| 23 |
+
);
|
| 24 |
+
|
| 25 |
+
--tile-start-rgb: 239, 245, 249;
|
| 26 |
+
--tile-end-rgb: 228, 232, 233;
|
| 27 |
+
--tile-border: conic-gradient(
|
| 28 |
+
#00000080,
|
| 29 |
+
#00000040,
|
| 30 |
+
#00000030,
|
| 31 |
+
#00000020,
|
| 32 |
+
#00000010,
|
| 33 |
+
#00000010,
|
| 34 |
+
#00000080
|
| 35 |
+
);
|
| 36 |
+
|
| 37 |
+
--callout-rgb: 238, 240, 241;
|
| 38 |
+
--callout-border-rgb: 172, 175, 176;
|
| 39 |
+
--card-rgb: 180, 185, 188;
|
| 40 |
+
--card-border-rgb: 131, 134, 135;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
@media (prefers-color-scheme: dark) {
|
| 44 |
+
:root {
|
| 45 |
+
--foreground-rgb: 255, 255, 255;
|
| 46 |
+
--background-start-rgb: 0, 0, 0;
|
| 47 |
+
--background-end-rgb: 0, 0, 0;
|
| 48 |
+
|
| 49 |
+
--primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0));
|
| 50 |
+
--secondary-glow: linear-gradient(
|
| 51 |
+
to bottom right,
|
| 52 |
+
rgba(1, 65, 255, 0),
|
| 53 |
+
rgba(1, 65, 255, 0),
|
| 54 |
+
rgba(1, 65, 255, 0.3)
|
| 55 |
+
);
|
| 56 |
+
|
| 57 |
+
--tile-start-rgb: 2, 13, 46;
|
| 58 |
+
--tile-end-rgb: 2, 5, 19;
|
| 59 |
+
--tile-border: conic-gradient(
|
| 60 |
+
#ffffff80,
|
| 61 |
+
#ffffff40,
|
| 62 |
+
#ffffff30,
|
| 63 |
+
#ffffff20,
|
| 64 |
+
#ffffff10,
|
| 65 |
+
#ffffff10,
|
| 66 |
+
#ffffff80
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
--callout-rgb: 20, 20, 20;
|
| 70 |
+
--callout-border-rgb: 108, 108, 108;
|
| 71 |
+
--card-rgb: 100, 100, 100;
|
| 72 |
+
--card-border-rgb: 200, 200, 200;
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
* {
|
| 77 |
+
box-sizing: border-box;
|
| 78 |
+
padding: 0;
|
| 79 |
+
margin: 0;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
html,
|
| 83 |
+
body {
|
| 84 |
+
max-width: 100vw;
|
| 85 |
+
overflow-x: hidden;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
body {
|
| 89 |
+
color: rgb(var(--foreground-rgb));
|
| 90 |
+
background: linear-gradient(
|
| 91 |
+
to bottom,
|
| 92 |
+
transparent,
|
| 93 |
+
rgb(var(--background-end-rgb))
|
| 94 |
+
)
|
| 95 |
+
rgb(var(--background-start-rgb));
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
a {
|
| 99 |
+
color: inherit;
|
| 100 |
+
text-decoration: none;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
@media (prefers-color-scheme: dark) {
|
| 104 |
+
html {
|
| 105 |
+
color-scheme: dark;
|
| 106 |
+
}
|
| 107 |
+
}
|
app/layout.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Inter } from "next/font/google";
|
| 2 |
+
import "./globals.css";
|
| 3 |
+
|
| 4 |
+
const inter = Inter({ subsets: ["latin"] });
|
| 5 |
+
|
| 6 |
+
export const metadata = {
|
| 7 |
+
title: "Create Next App",
|
| 8 |
+
description: "Generated by create next app",
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default function RootLayout({ children }) {
|
| 12 |
+
return (
|
| 13 |
+
<html lang="en">
|
| 14 |
+
<body className={inter.className}>{children}</body>
|
| 15 |
+
</html>
|
| 16 |
+
);
|
| 17 |
+
}
|
app/page.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
import { useState } from "react";
|
| 3 |
+
import Head from "next/head";
|
| 4 |
+
import styles from "./page.module.css";
|
| 5 |
+
|
| 6 |
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
| 7 |
+
|
| 8 |
+
export default function Home() {
|
| 9 |
+
const [prediction, setPrediction] = useState(null);
|
| 10 |
+
const [error, setError] = useState(null);
|
| 11 |
+
|
| 12 |
+
const handleSubmit = async (e) => {
|
| 13 |
+
e.preventDefault();
|
| 14 |
+
const response = await fetch("/api/predictions", {
|
| 15 |
+
method: "POST",
|
| 16 |
+
headers: {
|
| 17 |
+
"Content-Type": "application/json",
|
| 18 |
+
},
|
| 19 |
+
body: JSON.stringify({
|
| 20 |
+
image: e.target.imgUrl.value,
|
| 21 |
+
prompt: e.target.prompt.value,
|
| 22 |
+
}),
|
| 23 |
+
});
|
| 24 |
+
let prediction = await response.json();
|
| 25 |
+
if (response.status !== 201) {
|
| 26 |
+
setError(prediction.detail);
|
| 27 |
+
return;
|
| 28 |
+
}
|
| 29 |
+
setPrediction(prediction);
|
| 30 |
+
|
| 31 |
+
while (
|
| 32 |
+
prediction.status !== "succeeded" &&
|
| 33 |
+
prediction.status !== "failed"
|
| 34 |
+
) {
|
| 35 |
+
await sleep(1000);
|
| 36 |
+
const response = await fetch("/api/predictions/" + prediction.id);
|
| 37 |
+
prediction = await response.json();
|
| 38 |
+
if (response.status !== 200) {
|
| 39 |
+
setError(prediction.detail);
|
| 40 |
+
return;
|
| 41 |
+
}
|
| 42 |
+
setPrediction(prediction);
|
| 43 |
+
}
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
return (
|
| 47 |
+
<div className={styles.container}>
|
| 48 |
+
<Head>
|
| 49 |
+
<title>Replicate + Next.js</title>
|
| 50 |
+
</Head>
|
| 51 |
+
|
| 52 |
+
<p>
|
| 53 |
+
Large Vision Language model - {" "}
|
| 54 |
+
<a href="https://replicate.com/lucataco/qwen-vl-chat">QWEN-VL-CHAT</a>:
|
| 55 |
+
</p>
|
| 56 |
+
|
| 57 |
+
<form className={styles.form} onSubmit={handleSubmit}>
|
| 58 |
+
<input type="text" name="imgUrl" placeholder="Enter image url here" />
|
| 59 |
+
<input type="text" name="prompt" placeholder="Enter text prompt here" />
|
| 60 |
+
<button type="submit">Go!</button>
|
| 61 |
+
</form>
|
| 62 |
+
|
| 63 |
+
{error && <div>{error}</div>}
|
| 64 |
+
|
| 65 |
+
{prediction && (
|
| 66 |
+
<div>
|
| 67 |
+
<p>Output: {prediction.output}</p>
|
| 68 |
+
<p>Status: {prediction.status}</p>
|
| 69 |
+
</div>
|
| 70 |
+
)}
|
| 71 |
+
</div>
|
| 72 |
+
);
|
| 73 |
+
}
|
app/page.module.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.container {
|
| 2 |
+
padding: 2rem;
|
| 3 |
+
font-size: 1.3rem;
|
| 4 |
+
max-width: 48rem;
|
| 5 |
+
margin: 0 auto;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
.form {
|
| 9 |
+
display: flex;
|
| 10 |
+
margin-bottom: 2rem;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
.form input {
|
| 14 |
+
width: 100%;
|
| 15 |
+
padding: 1rem;
|
| 16 |
+
border: 1px solid #000;
|
| 17 |
+
border-radius: 0.25rem;
|
| 18 |
+
font-size: 1.3rem;
|
| 19 |
+
margin-right: 1rem;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.form button {
|
| 23 |
+
padding: 1rem;
|
| 24 |
+
border: none;
|
| 25 |
+
border-radius: 0.25rem;
|
| 26 |
+
box-sizing: border-box;
|
| 27 |
+
cursor: pointer;
|
| 28 |
+
font-size: 1.3rem;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.imageWrapper {
|
| 32 |
+
width: 100%;
|
| 33 |
+
aspect-ratio: 1 / 1;
|
| 34 |
+
position: relative
|
| 35 |
+
}
|
jsconfig.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"paths": {
|
| 4 |
+
"@/*": ["./*"]
|
| 5 |
+
}
|
| 6 |
+
}
|
| 7 |
+
}
|
next.config.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** @type {import('next').NextConfig} */
|
| 2 |
+
const nextConfig = {
|
| 3 |
+
reactStrictMode: true,
|
| 4 |
+
images: {
|
| 5 |
+
remotePatterns: [
|
| 6 |
+
{
|
| 7 |
+
protocol: "https",
|
| 8 |
+
hostname: "replicate.com",
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
protocol: "https",
|
| 12 |
+
hostname: "replicate.delivery",
|
| 13 |
+
},
|
| 14 |
+
],
|
| 15 |
+
},
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default nextConfig;
|
package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "nextjs-replicate",
|
| 3 |
+
"version": "0.1.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"scripts": {
|
| 6 |
+
"dev": "next dev",
|
| 7 |
+
"build": "next build",
|
| 8 |
+
"start": "next start",
|
| 9 |
+
"lint": "next lint"
|
| 10 |
+
},
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"react": "^18",
|
| 13 |
+
"react-dom": "^18",
|
| 14 |
+
"next": "14.1.0"
|
| 15 |
+
},
|
| 16 |
+
"devDependencies": {
|
| 17 |
+
"eslint": "^8",
|
| 18 |
+
"eslint-config-next": "14.1.0"
|
| 19 |
+
}
|
| 20 |
+
}
|
pages/api/predictions/[id].js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default async function handler(req, res) {
|
| 2 |
+
const response = await fetch(
|
| 3 |
+
"https://api.replicate.com/v1/predictions/" + req.query.id,
|
| 4 |
+
{
|
| 5 |
+
headers: {
|
| 6 |
+
Authorization: `Token ${process.env.REPLICATE_API_TOKEN}`,
|
| 7 |
+
"Content-Type": "application/json",
|
| 8 |
+
},
|
| 9 |
+
}
|
| 10 |
+
);
|
| 11 |
+
if (response.status !== 200) {
|
| 12 |
+
let error = await response.json();
|
| 13 |
+
res.statusCode = 500;
|
| 14 |
+
res.end(JSON.stringify({ detail: error.detail }));
|
| 15 |
+
return;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
const prediction = await response.json();
|
| 19 |
+
res.end(JSON.stringify(prediction));
|
| 20 |
+
}
|
pages/api/predictions/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default async function handler(req, res) {
|
| 2 |
+
const response = await fetch("https://api.replicate.com/v1/predictions", {
|
| 3 |
+
method: "POST",
|
| 4 |
+
headers: {
|
| 5 |
+
Authorization: `Token ${process.env.REPLICATE_API_TOKEN}`,
|
| 6 |
+
"Content-Type": "application/json",
|
| 7 |
+
},
|
| 8 |
+
body: JSON.stringify({
|
| 9 |
+
// Pinned to a specific version of qwen-vl-chat
|
| 10 |
+
// See https://replicate.com/lucataco/qwen-vl-chat
|
| 11 |
+
version: process.env.MODEL_CODE,
|
| 12 |
+
|
| 13 |
+
// This is the text prompt that will be submitted by a form on the frontend
|
| 14 |
+
input: {
|
| 15 |
+
image: req.body.image,
|
| 16 |
+
prompt: req.body.prompt
|
| 17 |
+
},
|
| 18 |
+
}),
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
if (response.status !== 201) {
|
| 22 |
+
let error = await response.json();
|
| 23 |
+
res.statusCode = 500;
|
| 24 |
+
res.end(JSON.stringify({ detail: error.detail }));
|
| 25 |
+
return;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
const prediction = await response.json();
|
| 29 |
+
res.statusCode = 201;
|
| 30 |
+
res.end(JSON.stringify(prediction));
|
| 31 |
+
}
|
public/next.svg
ADDED
|
|
public/vercel.svg
ADDED
|
|