├── models
├── .env.example
├── image-captioning
│ ├── model
│ │ └── .gitkeep
│ ├── app
│ │ ├── __init__.py
│ │ ├── image.py
│ │ ├── save_model.py
│ │ ├── api.py
│ │ ├── predict.py
│ │ └── main.py
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── sentiment-de
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── sentiment_analysis.py
│ │ ├── main.py
│ │ └── api.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── sentiment-en
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── sentiment_analysis.py
│ │ ├── main.py
│ │ └── api.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── summarization-en
│ ├── model
│ │ └── .gitkeep
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── text_summarization.py
│ │ ├── main.py
│ │ └── api.py
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── whisper-tiny-en
│ ├── app
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-39.pyc
│ │ │ └── save_model.cpython-39.pyc
│ │ ├── save_model.py
│ │ ├── main.py
│ │ ├── predict.py
│ │ └── api.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── image-classification
│ ├── app
│ │ ├── __init__.py
│ │ ├── image.py
│ │ ├── save_model.py
│ │ ├── predict.py
│ │ ├── api.py
│ │ └── main.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── image-generation-sd
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── predict.py
│ │ ├── api.py
│ │ └── main.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── requirements.txt
│ └── requirements_windows.txt
├── language-detection
│ ├── app
│ │ ├── __init__.py
│ │ ├── main.py
│ │ ├── api.py
│ │ └── language_detection.py
│ ├── model
│ │ └── lid.176.ftz
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── ocr-base-handwritten
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── image.py
│ │ ├── api.py
│ │ ├── predict.py
│ │ └── main.py
│ ├── model
│ │ └── .gitkeep
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── text-generation-en-lg
│ ├── model
│ │ └── .gitkeep
│ ├── app
│ │ ├── __init__.py
│ │ ├── save_model.py
│ │ ├── text_generation.py
│ │ ├── main.py
│ │ └── api.py
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
└── text-generation-en-sm
│ ├── model
│ └── .gitkeep
│ ├── app
│ ├── __init__.py
│ ├── save_model.py
│ ├── text_generation.py
│ ├── main.py
│ └── api.py
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── LICENSE
│ └── requirements.txt
├── packages
├── database
│ ├── .env
│ ├── src
│ │ ├── index.ts
│ │ └── client.ts
│ ├── .eslintrc.js
│ ├── prisma
│ │ └── migrations
│ │ │ ├── 20230511054149_add_instructions_to_api
│ │ │ └── migration.sql
│ │ │ ├── migration_lock.toml
│ │ │ ├── 20230511150450_remove_endpoint_url
│ │ │ └── migration.sql
│ │ │ └── 20230511150334_add_models_to_api
│ │ │ └── migration.sql
│ ├── tsconfig.json
│ ├── tsup.config.ts
│ └── package.json
├── ui
│ ├── src
│ │ └── index.tsx
│ ├── tsconfig.json
│ └── package.json
├── lib
│ ├── .eslintrc.js
│ ├── tsconfig.json
│ ├── hashString.ts
│ ├── cn.ts
│ ├── constants.ts
│ ├── package.json
│ ├── posthogServer.ts
│ └── fetcher.ts
├── tsconfig
│ ├── package.json
│ ├── react-library.json
│ ├── node16.json
│ ├── base.json
│ └── nextjs.json
├── eslint-config-cargoship
│ ├── index.js
│ └── package.json
├── tailwind-config
│ ├── package.json
│ └── tailwind.config.js
└── prettier-config
│ ├── package.json
│ ├── prettier-preset.js
│ └── merged-prettier-plugin.js
├── pnpm-workspace.yaml
├── .prettierrc.js
├── apps
├── web
│ ├── app
│ │ ├── globals.css
│ │ ├── auth
│ │ │ ├── forgot-password
│ │ │ │ ├── reset
│ │ │ │ │ ├── page.tsx
│ │ │ │ │ └── success
│ │ │ │ │ │ └── page.tsx
│ │ │ │ ├── page.tsx
│ │ │ │ └── email-sent
│ │ │ │ │ └── page.tsx
│ │ │ ├── verify
│ │ │ │ └── page.tsx
│ │ │ ├── signup-without-verification-success
│ │ │ │ └── page.tsx
│ │ │ ├── login
│ │ │ │ └── page.tsx
│ │ │ ├── signup
│ │ │ │ └── page.tsx
│ │ │ └── verification-requested
│ │ │ │ └── page.tsx
│ │ ├── api
│ │ │ └── auth
│ │ │ │ └── [...nextauth]
│ │ │ │ └── route.ts
│ │ ├── teams
│ │ │ └── [teamId]
│ │ │ │ ├── settings
│ │ │ │ └── page.tsx
│ │ │ │ ├── layout.tsx
│ │ │ │ └── apis
│ │ │ │ └── page.tsx
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ ├── PosthogIdentify.tsx
│ │ └── PosthogClient.tsx
│ ├── .eslintrc.js
│ ├── public
│ │ └── favicon.png
│ ├── images
│ │ └── avatar-placeholder.png
│ ├── postcss.config.js
│ ├── .vscode
│ │ └── settings.json
│ ├── components
│ │ ├── ToasterClient.tsx
│ │ ├── LoadingSpinner.tsx
│ │ ├── auth
│ │ │ ├── BackToLoginButton.tsx
│ │ │ ├── SignIn.tsx
│ │ │ ├── GithubButton.tsx
│ │ │ └── RequestVerificationEmail.tsx
│ │ ├── ContentWrapper.tsx
│ │ ├── ui
│ │ │ └── Code.tsx
│ │ └── EmptyPageFiller.tsx
│ ├── tailwind.config.js
│ ├── next-env.d.ts
│ ├── lib
│ │ ├── teams.ts
│ │ ├── membershipsClient.ts
│ │ ├── apiKeys.ts
│ │ ├── memberships.ts
│ │ ├── jwt.ts
│ │ ├── auth.ts
│ │ ├── apis.ts
│ │ ├── apiKeysClient.ts
│ │ ├── docker.ts
│ │ └── apiHelper.ts
│ ├── types
│ │ └── next-auth.d.ts
│ ├── Dockerfile
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── pages
│ │ └── api
│ │ │ ├── apis
│ │ │ ├── index.ts
│ │ │ └── [apiId]
│ │ │ │ └── index.ts
│ │ │ ├── memberships
│ │ │ └── index.ts
│ │ │ ├── users
│ │ │ ├── me
│ │ │ │ └── index.ts
│ │ │ ├── forgot-password.tsx
│ │ │ ├── verification-email.tsx
│ │ │ └── reset-password.tsx
│ │ │ └── teams
│ │ │ └── [teamId]
│ │ │ └── index.ts
│ └── next.config.js
├── demo
│ ├── .env.example
│ ├── .eslintrc.js
│ ├── styles
│ │ └── globals.css
│ ├── public
│ │ ├── favicon.ico
│ │ ├── vercel.svg
│ │ ├── thirteen.svg
│ │ └── next.svg
│ ├── lib
│ │ ├── utils.ts
│ │ ├── sentiment.ts
│ │ ├── detectLanguage.ts
│ │ └── storage.ts
│ ├── postcss.config.js
│ ├── pages
│ │ ├── _app.tsx
│ │ ├── _document.tsx
│ │ └── api
│ │ │ ├── sentiment.ts
│ │ │ └── detect-language.ts
│ ├── tailwind.config.js
│ ├── components
│ │ ├── ContentWrapper.tsx
│ │ ├── Confetti.tsx
│ │ └── LayoutApp.tsx
│ ├── .gitignore
│ ├── next.config.js
│ ├── tsconfig.json
│ └── package.json
└── cargoship-sh
│ ├── .eslintrc.js
│ ├── images
│ ├── app-preview.png
│ ├── collection-ocr.jpg
│ ├── hero-preview.png
│ ├── collection-generation.jpg
│ ├── collection-summarization.jpg
│ ├── sh_mpstkl_logo-300x150.jpg
│ ├── collection-data-processing.jpg
│ ├── collection-text-generation.jpg
│ ├── collection-image-captioning.jpg
│ ├── collection-image-generation.jpg
│ ├── collection-image-recognition.jpg
│ ├── collection-language-detection.jpg
│ ├── collection-sentiment-analysis.jpg
│ ├── collection-text-generation2.jpg
│ ├── collection-audio-transcription.jpg
│ └── collection-image-generation-sd.jpg
│ ├── postcss.config.js
│ ├── public
│ ├── fonts
│ │ ├── lexend.woff2
│ │ ├── Poppins-Bold.woff
│ │ ├── Poppins-Thin.woff
│ │ ├── Poppins-Black.woff
│ │ ├── Poppins-Black.woff2
│ │ ├── Poppins-Bold.woff2
│ │ ├── Poppins-Light.woff
│ │ ├── Poppins-Light.woff2
│ │ ├── Poppins-Medium.woff
│ │ ├── Poppins-Thin.woff2
│ │ ├── Inter-italic.var.woff2
│ │ ├── Inter-roman.var.woff2
│ │ ├── Poppins-ExtraBold.woff
│ │ ├── Poppins-Medium.woff2
│ │ ├── Poppins-Regular.woff
│ │ ├── Poppins-Regular.woff2
│ │ ├── Poppins-SemiBold.woff
│ │ ├── Poppins-SemiBold.woff2
│ │ ├── Poppins-ExtraBold.woff2
│ │ ├── Poppins-ExtraLight.woff
│ │ └── Poppins-ExtraLight.woff2
│ ├── social-image.png
│ ├── favicon
│ │ ├── favicon.ico
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── mstile-70x70.png
│ │ ├── apple-touch-icon.png
│ │ ├── mstile-144x144.png
│ │ ├── mstile-150x150.png
│ │ ├── mstile-310x150.png
│ │ ├── mstile-310x310.png
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── browserconfig.xml
│ │ ├── site.webmanifest
│ │ └── safari-pinned-tab.svg
│ └── robots.txt
│ ├── pages
│ ├── blog
│ │ ├── model-bias
│ │ │ └── model-bias.png
│ │ └── why-we-developed-cargoship
│ │ │ └── cargoship-explained.png
│ ├── _app.tsx
│ ├── docs
│ │ ├── index.mdx
│ │ ├── basics
│ │ │ └── basics
│ │ │ │ └── index.mdx
│ │ └── introduction
│ │ │ ├── why-cargoship
│ │ │ └── index.mdx
│ │ │ └── your-benefits
│ │ │ └── index.mdx
│ ├── cloud
│ │ └── index.tsx
│ ├── index.tsx
│ └── collections
│ │ └── data-processing
│ │ └── index.tsx
│ ├── next-sitemap.config.js
│ ├── styles
│ ├── globals.css
│ └── prism.css
│ ├── lib
│ ├── utils.ts
│ ├── articles.ts
│ └── docsNavigation.ts
│ ├── components
│ ├── shared
│ │ ├── GithubInfo.tsx
│ │ ├── DiscordCTA.tsx
│ │ ├── API_CTA.tsx
│ │ ├── MetaInformation.tsx
│ │ ├── UnderConstructionCTA.tsx
│ │ ├── icons
│ │ │ └── InstallationIcon.jsx
│ │ ├── TryItCTA.tsx
│ │ ├── Prose.jsx
│ │ └── Callout.tsx
│ ├── layout
│ │ ├── Layout.tsx
│ │ └── LayoutMdx.tsx
│ ├── home
│ │ └── BackgroundGradient.tsx
│ └── cloud
│ │ └── CTA.tsx
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── LICENSE
│ ├── package.json
│ └── next.config.mjs
├── .npmrc
├── .eslintrc.js
├── .vscode
└── extensions.json
├── docker-compose.yml
├── .dockerignore
├── .github
└── workflows
│ └── checks.yml
├── docker-compose.dev.yml
├── .gitignore
├── package.json
└── turbo.json
/models/.env.example:
--------------------------------------------------------------------------------
1 | API_KEY=
--------------------------------------------------------------------------------
/packages/database/.env:
--------------------------------------------------------------------------------
1 | ../../.env
--------------------------------------------------------------------------------
/models/image-captioning/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-de/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-de/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-en/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-en/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/summarization-en/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-captioning/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-classification/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-classification/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-generation-sd/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-generation-sd/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/language-detection/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-en/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/summarization-en/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/text-generation-en-lg/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/model/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/image-captioning/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/image-classification/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/image-generation-sd/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/sentiment-de/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
2 |
--------------------------------------------------------------------------------
/models/summarization-en/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
--------------------------------------------------------------------------------
/models/text-generation-en-lg/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/text-generation-en-lg/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
2 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/.dockerignore:
--------------------------------------------------------------------------------
1 | model/*
2 |
--------------------------------------------------------------------------------
/packages/database/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./client";
2 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - "apps/*"
3 | - "packages/*"
4 |
--------------------------------------------------------------------------------
/packages/ui/src/index.tsx:
--------------------------------------------------------------------------------
1 | export * from "./Button";
2 | export * from "./Logo";
3 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = require("./packages/prettier-config/prettier-preset");
2 |
--------------------------------------------------------------------------------
/apps/web/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/apps/demo/.env.example:
--------------------------------------------------------------------------------
1 | CARGOSHIP_API_HOST=https://app.cargoship.sh
2 | CARGOSHIP_API_KEY=YOUR_API_KEY
--------------------------------------------------------------------------------
/apps/demo/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ["cargoship"],
4 | };
5 |
--------------------------------------------------------------------------------
/apps/demo/styles/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/apps/web/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ["cargoship"],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/lib/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ["cargoship"],
4 | };
5 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ["cargoship"],
4 | };
5 |
--------------------------------------------------------------------------------
/packages/database/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ["cargoship"],
4 | };
5 |
--------------------------------------------------------------------------------
/apps/demo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/demo/public/favicon.ico
--------------------------------------------------------------------------------
/apps/web/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/web/public/favicon.png
--------------------------------------------------------------------------------
/apps/demo/lib/utils.ts:
--------------------------------------------------------------------------------
1 | export function classNames(...classes: any) {
2 | return classes.filter(Boolean).join(" ");
3 | }
4 |
--------------------------------------------------------------------------------
/apps/demo/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/apps/web/images/avatar-placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/web/images/avatar-placeholder.png
--------------------------------------------------------------------------------
/apps/web/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/app-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/app-preview.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-ocr.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-ocr.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/hero-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/hero-preview.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/lexend.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/lexend.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/social-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/social-image.png
--------------------------------------------------------------------------------
/models/language-detection/model/lid.176.ftz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/models/language-detection/model/lid.176.ftz
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/favicon.ico
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Bold.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Thin.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Thin.woff
--------------------------------------------------------------------------------
/packages/tsconfig/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/tsconfig",
3 | "version": "1.0.0",
4 | "private": true,
5 | "license": "MIT"
6 | }
7 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-generation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-generation.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/mstile-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/mstile-70x70.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Black.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Black.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Black.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Black.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Bold.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Light.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Light.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Medium.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Thin.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-summarization.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-summarization.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/sh_mpstkl_logo-300x150.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/sh_mpstkl_logo-300x150.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/mstile-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/mstile-144x144.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/mstile-150x150.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/mstile-310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/mstile-310x150.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/mstile-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/mstile-310x310.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Inter-italic.var.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Inter-italic.var.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Inter-roman.var.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Inter-roman.var.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-ExtraBold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-ExtraBold.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Medium.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Regular.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-Regular.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-SemiBold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-SemiBold.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-SemiBold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-SemiBold.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-data-processing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-data-processing.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-text-generation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-text-generation.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/blog/model-bias/model-bias.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/pages/blog/model-bias/model-bias.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-ExtraBold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-ExtraBold.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-ExtraLight.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-ExtraLight.woff
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/fonts/Poppins-ExtraLight.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/fonts/Poppins-ExtraLight.woff2
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-image-captioning.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-image-captioning.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-image-generation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-image-generation.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-image-recognition.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-image-recognition.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-language-detection.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-language-detection.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-sentiment-analysis.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-sentiment-analysis.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-text-generation2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-text-generation2.jpg
--------------------------------------------------------------------------------
/packages/lib/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@cargoship/tsconfig/js-library.json",
3 | "include": ["."],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ui/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@cargoship/tsconfig/react-library.json",
3 | "include": ["."],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-audio-transcription.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-audio-transcription.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/images/collection-image-generation-sd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/images/collection-image-generation-sd.jpg
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/android-chrome-192x192.png
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/public/favicon/android-chrome-512x512.png
--------------------------------------------------------------------------------
/packages/database/prisma/migrations/20230511054149_add_instructions_to_api/migration.sql:
--------------------------------------------------------------------------------
1 | -- AlterTable
2 | ALTER TABLE "Api" ADD COLUMN "instructions" JSONB DEFAULT '{}';
3 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/models/whisper-tiny-en/app/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | auto-install-peers=true
2 | link-workspace-packages = true
3 | shamefully-hoist = true
4 | shared-workspace-shrinkwrap = true
5 | access = public
6 | enable-pre-post-scripts = true
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/__pycache__/save_model.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/models/whisper-tiny-en/app/__pycache__/save_model.cpython-39.pyc
--------------------------------------------------------------------------------
/apps/web/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.tsdk": "../../node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib",
3 | "typescript.enablePromptUseWorkspaceTsdk": true
4 | }
--------------------------------------------------------------------------------
/apps/web/components/ToasterClient.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { Toaster } from "react-hot-toast";
4 |
5 | export default function ToasterClient() {
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/database/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "postgresql"
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/robots.txt:
--------------------------------------------------------------------------------
1 | # *
2 | User-agent: *
3 | Allow: /
4 |
5 | # Host
6 | Host: https://cargoship.sh
7 |
8 | # Sitemaps
9 | Sitemap: https://cargoship.sh/sitemap.xml
10 |
--------------------------------------------------------------------------------
/packages/lib/hashString.ts:
--------------------------------------------------------------------------------
1 | import crypto from "crypto";
2 |
3 | export const hashString = (string: string) => {
4 | return crypto.createHash("sha256").update(string).digest("hex");
5 | };
6 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/next-sitemap.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next-sitemap').IConfig} */
2 | module.exports = {
3 | siteUrl: "https://cargoship.sh",
4 | generateRobotsTxt: true, // (optional)
5 | };
6 |
--------------------------------------------------------------------------------
/packages/database/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@cargoship/tsconfig/node16.json",
3 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "tsup.config.ts"],
4 | "exclude": ["node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/lib/cn.ts:
--------------------------------------------------------------------------------
1 | import { ClassValue, clsx } from "clsx";
2 | import { twMerge } from "tailwind-merge";
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs));
6 | }
7 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/blog/why-we-developed-cargoship/cargoship-explained.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cargoshipsh/cargoship/HEAD/apps/cargoship-sh/pages/blog/why-we-developed-cargoship/cargoship-explained.png
--------------------------------------------------------------------------------
/apps/web/app/auth/forgot-password/reset/page.tsx:
--------------------------------------------------------------------------------
1 | import { ResetPasswordForm } from "@/components/auth/ResetPasswordForm";
2 |
3 | export default function ResetPasswordPage() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/styles/globals.css:
--------------------------------------------------------------------------------
1 | @import "tailwindcss/base";
2 | @import "./fonts.css";
3 | @import "./docsearch.css";
4 | @import "./prism.css";
5 | @import "tailwindcss/components";
6 | @import "tailwindcss/utilities";
7 |
--------------------------------------------------------------------------------
/apps/web/app/auth/forgot-password/page.tsx:
--------------------------------------------------------------------------------
1 | import { PasswordResetForm } from "../../../components/auth/PasswordResetForm";
2 |
3 | export default function ForgotPasswordPage() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/eslint-config-cargoship/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ["next", "turbo", "prettier"],
3 | rules: {
4 | "@next/next/no-html-link-for-pages": "off",
5 | "react/jsx-key": "off",
6 | },
7 | };
8 |
--------------------------------------------------------------------------------
/apps/web/app/api/auth/[...nextauth]/route.ts:
--------------------------------------------------------------------------------
1 | import NextAuth from "next-auth";
2 | import { authOptions } from "./authOptions";
3 |
4 | const handler = NextAuth(authOptions);
5 |
6 | export { handler as GET, handler as POST };
7 |
--------------------------------------------------------------------------------
/apps/web/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@cargoship/tailwind-config/tailwind.config");
2 |
3 | /** @type {import('tailwindcss').Config} */
4 | module.exports = {
5 | ...base,
6 | content: [...base.content],
7 | };
8 |
--------------------------------------------------------------------------------
/apps/web/components/LoadingSpinner.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { TailSpin } from "react-loader-spinner";
4 |
5 | export default function LoadingSpinner() {
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/models/sentiment-de/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/sentiment-en/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-en:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/image-captioning/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/summarization-en/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/image-classification/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/image-generation-sd/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | sentiment-api-de:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/text-generation-en-lg/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | text-generation:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | text-generation:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/models/language-detection/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | language-detection-api:
4 | restart: unless-stopped
5 | build: .
6 | environment:
7 | - API_KEY=CHANGE_ME
8 | ports:
9 | - 80:80
10 |
--------------------------------------------------------------------------------
/packages/lib/constants.ts:
--------------------------------------------------------------------------------
1 | // URLs
2 | const VERCEL_URL = process.env.NEXT_PUBLIC_VERCEL_URL ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` : "";
3 | export const WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL || VERCEL_URL || "http://localhost:3000";
4 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | // This tells ESLint to load the config from the package `eslint-config-custom`
4 | extends: ["custom"],
5 | settings: {
6 | next: {
7 | rootDir: ["apps/*/"],
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/lib/utils.ts:
--------------------------------------------------------------------------------
1 | export function formatDate(dateString: string) {
2 | return new Date(`${dateString}T00:00:00Z`).toLocaleDateString("en-US", {
3 | day: "numeric",
4 | month: "long",
5 | year: "numeric",
6 | timeZone: "UTC",
7 | });
8 | }
9 |
--------------------------------------------------------------------------------
/packages/tailwind-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/tailwind-config",
3 | "version": "0.0.0",
4 | "private": true,
5 | "main": "index.js",
6 | "devDependencies": {
7 | "@tailwindcss/forms": "^0.5.3",
8 | "tailwindcss": "^3.1.4"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/prettier-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/prettier-config",
3 | "version": "1.0.0",
4 | "private": true,
5 | "license": "MIT",
6 | "devDependencies": {
7 | "prettier": "^2.7.1",
8 | "prettier-plugin-tailwindcss": "^0.1.13"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/database/prisma/migrations/20230511150450_remove_endpoint_url/migration.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Warnings:
3 |
4 | - You are about to drop the column `endpointUrl` on the `Api` table. All the data in the column will be lost.
5 |
6 | */
7 | -- AlterTable
8 | ALTER TABLE "Api" DROP COLUMN "endpointUrl";
9 |
--------------------------------------------------------------------------------
/apps/web/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
5 | // NOTE: This file should not be edited
6 | // see https://nextjs.org/docs/basic-features/typescript for more information.
7 |
--------------------------------------------------------------------------------
/packages/database/src/client.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client";
2 |
3 | declare global {
4 | var prisma: PrismaClient | undefined;
5 | }
6 |
7 | export const prisma = global.prisma || new PrismaClient();
8 |
9 | if (process.env.NODE_ENV !== "production") global.prisma = prisma;
10 |
--------------------------------------------------------------------------------
/apps/web/components/auth/BackToLoginButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@/components/ui/Button";
2 |
3 | export default function BackToLoginButton() {
4 | return (
5 |
6 | Login
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #da532c
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/apps/web/app/teams/[teamId]/settings/page.tsx:
--------------------------------------------------------------------------------
1 | import { getApiKeys } from "@/lib/apiKeys";
2 | import ProfileSettingsPage from "@/app/teams/[teamId]/settings/ProfileSettingsPage";
3 |
4 | export default async function SettingsPage({}) {
5 | const apiKeys = await getApiKeys();
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/models/language-detection/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | EXPOSE 80
12 |
13 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/packages/prettier-config/prettier-preset.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: true,
3 | bracketSameLine: true,
4 | singleQuote: false,
5 | jsxSingleQuote: false,
6 | trailingComma: "es5",
7 | semi: true,
8 | printWidth: 110,
9 | arrowParens: "always",
10 | plugins: [require("./merged-prettier-plugin")],
11 | };
12 |
--------------------------------------------------------------------------------
/apps/demo/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import type { AppProps } from "next/app";
2 | import { Toaster } from "react-hot-toast";
3 | import "../styles/globals.css";
4 |
5 | export default function App({ Component, pageProps }: AppProps) {
6 | return (
7 | <>
8 |
9 |
10 | >
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/apps/demo/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | "./app/**/*.{js,ts,jsx,tsx}",
5 | "./pages/**/*.{js,ts,jsx,tsx}",
6 | "./components/**/*.{js,ts,jsx,tsx}",
7 | ],
8 | theme: {
9 | extend: {},
10 | },
11 | plugins: [require("@tailwindcss/forms")],
12 | };
13 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/app/save_model.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import AutoTokenizer, AutoModelForCausalLM
3 |
4 | # load and save bert model
5 | tokenizer = AutoTokenizer.from_pretrained("gpt2")
6 | model = AutoModelForCausalLM.from_pretrained("gpt2")
7 |
8 | torch.save(model, "model/model.pt")
9 | torch.save(tokenizer, "model/tokenizer.pt")
--------------------------------------------------------------------------------
/models/text-generation-en-lg/app/save_model.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import AutoTokenizer, AutoModelForCausalLM
3 |
4 | tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
5 |
6 | model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
7 |
8 | torch.save(model, "model/model.pt")
9 | torch.save(tokenizer, "model/tokenizer.pt")
--------------------------------------------------------------------------------
/packages/database/tsup.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "tsup";
2 |
3 | const isProduction = process.env.NODE_ENV === "production";
4 |
5 | export default defineConfig({
6 | clean: true,
7 | dts: true,
8 | entry: ["src/index.ts", "src/seed.ts"],
9 | format: ["cjs", "esm"],
10 | minify: isProduction,
11 | sourcemap: true,
12 | });
13 |
--------------------------------------------------------------------------------
/apps/demo/components/ContentWrapper.tsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 |
3 | interface ContentWrapperProps {
4 | children: React.ReactNode;
5 | className?: string;
6 | }
7 |
8 | export default function ContentWrapper({ children, className }: ContentWrapperProps) {
9 | return
{children}
;
10 | }
11 |
--------------------------------------------------------------------------------
/apps/demo/pages/_document.tsx:
--------------------------------------------------------------------------------
1 | import { Html, Head, Main, NextScript } from "next/document";
2 |
3 | export default function Document() {
4 | return (
5 |
6 |
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/apps/web/lib/teams.ts:
--------------------------------------------------------------------------------
1 | import useSWR from "swr";
2 | import { fetcher } from "./utils";
3 |
4 | export const useTeam = (id: string) => {
5 | const { data, error, mutate } = useSWR(`/api/teams/${id}/`, fetcher);
6 |
7 | return {
8 | team: data,
9 | isLoadingTeam: !error && !data,
10 | isErrorTeam: error,
11 | mutateTeam: mutate,
12 | };
13 | };
14 |
--------------------------------------------------------------------------------
/models/image-captioning/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/sentiment-de/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/sentiment-en/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/summarization-en/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/whisper-tiny-en/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/image-classification/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/image-generation-sd/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/text-generation-en-lg/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/models/text-generation-en-sm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-slim-bullseye
2 |
3 | WORKDIR /code
4 |
5 | RUN apt update && apt install build-essential -y
6 |
7 | COPY . .
8 |
9 | RUN pip install --no-cache-dir --upgrade -r requirements.txt
10 |
11 | RUN python -m app.save_model
12 |
13 | EXPOSE 80
14 |
15 | CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
--------------------------------------------------------------------------------
/packages/tsconfig/react-library.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "React Library",
4 | "extends": "./base.json",
5 | "compilerOptions": {
6 | "lib": ["ES2015", "DOM"],
7 | "module": "ESNext",
8 | "target": "ES6",
9 | "jsx": "react-jsx",
10 | "noUnusedLocals": true,
11 | "noUnusedParameters": true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
2 | import torch
3 |
4 | # load and save the tokenizer
5 | processor = AutoProcessor.from_pretrained("openai/whisper-tiny.en")
6 | model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-tiny.en")
7 |
8 | torch.save(processor, "model/processor.pt")
9 | torch.save(model, "model/model.pt")
--------------------------------------------------------------------------------
/packages/database/prisma/migrations/20230511150334_add_models_to_api/migration.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Warnings:
3 |
4 | - Made the column `instructions` on table `Api` required. This step will fail if there are existing NULL values in that column.
5 |
6 | */
7 | -- AlterTable
8 | ALTER TABLE "Api" ADD COLUMN "models" JSONB NOT NULL DEFAULT '[]',
9 | ALTER COLUMN "instructions" SET NOT NULL;
10 |
--------------------------------------------------------------------------------
/apps/web/components/auth/SignIn.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { signIn } from "next-auth/react";
4 | import { useEffect } from "react";
5 |
6 | export const SignIn = ({ token }) => {
7 | useEffect(() => {
8 | if (token) {
9 | signIn("token", {
10 | token: token,
11 | callbackUrl: `/`,
12 | });
13 | }
14 | }, [token]);
15 |
16 | return <>>;
17 | };
18 |
--------------------------------------------------------------------------------
/apps/web/lib/membershipsClient.ts:
--------------------------------------------------------------------------------
1 | import useSWR from "swr";
2 | import { fetcher } from "./utils";
3 |
4 | export const useMemberships = () => {
5 | const { data, error, mutate } = useSWR(`/api/memberships`, fetcher);
6 |
7 | return {
8 | memberships: data,
9 | isLoadingMemberships: !error && !data,
10 | isErrorMemberships: error,
11 | mutateMemberships: mutate,
12 | };
13 | };
14 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import PlausibleProvider from "next-plausible";
2 | import type { AppProps } from "next/app";
3 | import "../styles/globals.css";
4 |
5 | export default function App({ Component, pageProps }: AppProps) {
6 | return (
7 |
8 |
9 |
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/packages/prettier-config/merged-prettier-plugin.js:
--------------------------------------------------------------------------------
1 | /* @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss/issues/31#issuecomment-1024722576 */
2 | const tailwind = require("prettier-plugin-tailwindcss");
3 |
4 | const combinedFormatter = {
5 | parsers: {
6 | typescript: {
7 | ...tailwind.parsers.typescript,
8 | },
9 | },
10 | };
11 |
12 | module.exports = combinedFormatter;
13 |
--------------------------------------------------------------------------------
/apps/demo/components/Confetti.tsx:
--------------------------------------------------------------------------------
1 | import { useWindowSize } from "react-use";
2 | import ReactConfetti from "react-confetti";
3 |
4 | export function Confetti({ colors = ["#0ea5e9", "#eee"] }: { colors?: string[] }) {
5 | const { width, height } = useWindowSize();
6 | return (
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/packages/tsconfig/node16.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Node 16",
4 | "extends": "./base.json",
5 | "compilerOptions": {
6 | "lib": ["ES2021"],
7 | "module": "commonjs",
8 | "target": "ES2021",
9 | "strict": true,
10 | "esModuleInterop": true,
11 | "skipLibCheck": true,
12 | "forceConsistentCasingInFileNames": true
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import TrOCRProcessor, VisionEncoderDecoderModel
2 | import torch
3 |
4 | # load and save the tokenizer
5 |
6 | processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")
7 | model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten")
8 |
9 | torch.save(processor, "model/processor.pt")
10 | torch.save(model, "model/model.pt")
--------------------------------------------------------------------------------
/apps/web/types/next-auth.d.ts:
--------------------------------------------------------------------------------
1 | import NextAuth from "next-auth";
2 |
3 | declare module "next-auth" {
4 | /**
5 | * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
6 | */
7 | interface Session {
8 | user: {
9 | id: string;
10 | email: string;
11 | name: string;
12 | image?: StaticImageData;
13 | teamId?: string;
14 | };
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/models/image-generation-sd/app/save_model.py:
--------------------------------------------------------------------------------
1 | from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
2 | import torch
3 |
4 | scheduler = EulerDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-2-1-base", subfolder="scheduler")
5 | model = StableDiffusionPipeline.from_pretrained(
6 | "stabilityai/stable-diffusion-2-1-base", scheduler=scheduler, torch_dtype=torch.float16
7 | )
8 | torch.save(model, "model/model.pt")
--------------------------------------------------------------------------------
/apps/web/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:18.16-alpine
2 | RUN corepack enable && corepack prepare pnpm@latest --activate
3 |
4 | WORKDIR /app
5 |
6 | COPY . .
7 | # Copy .env file because Docker don't follow symlinks
8 | COPY .env /app/apps/web/
9 |
10 | RUN pnpm install
11 |
12 | # Build the project
13 | RUN pnpm dlx prisma generate
14 | RUN pnpm turbo run build --filter=web...
15 |
16 | CMD pnpm dlx prisma migrate deploy && pnpm db:seed && pnpm start --filter=web
--------------------------------------------------------------------------------
/apps/web/components/ContentWrapper.tsx:
--------------------------------------------------------------------------------
1 | export function ContentWrapper({ children }) {
2 | return (
3 |
4 | {/* Main content */}
5 |
6 |
7 | {children}
8 |
9 |
10 |
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/models/image-classification/app/image.py:
--------------------------------------------------------------------------------
1 | from app.api import Input
2 | from PIL import Image
3 | import requests
4 | from io import BytesIO
5 | import base64
6 |
7 | def getImage(input: Input) -> Image:
8 | if (input.url):
9 | return Image.open(requests.get(input.url, stream=True).raw)
10 | elif (input.base64):
11 | return Image.open(BytesIO(base64.b64decode(input.base64)))
12 | else:
13 | raise Exception("No image provided")
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/GithubInfo.tsx:
--------------------------------------------------------------------------------
1 | import Link from "next/link";
2 |
3 | export default function GithubInfo() {
4 | return (
5 |
8 | ⭐️ Cargoship is open source on Github. Help us by giving us a star! ⭐️
9 |
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/apps/demo/lib/sentiment.ts:
--------------------------------------------------------------------------------
1 | export const getSentiment = async (text: string): Promise => {
2 | const response = await fetch("/api/sentiment", {
3 | method: "POST",
4 | headers: {
5 | "Content-Type": "application/json",
6 | },
7 | body: JSON.stringify({ text }),
8 | });
9 | if (!response.ok) {
10 | throw Error("Sentiment API error");
11 | }
12 | const { sentiment } = await response.json();
13 | return sentiment;
14 | };
15 |
--------------------------------------------------------------------------------
/models/summarization-en/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import AutoTokenizer, BartForConditionalGeneration
2 | import torch
3 |
4 | # load and save bert model
5 | model = BartForConditionalGeneration.from_pretrained("philschmid/bart-large-cnn-samsum")
6 | torch.save(model, "model/bart.pt")
7 |
8 | # load and save bert tokenizer
9 | tokenizer = AutoTokenizer.from_pretrained("philschmid/bart-large-cnn-samsum")
10 | torch.save(tokenizer, "model/bart-tokenizer.pt")
--------------------------------------------------------------------------------
/models/image-classification/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import AutoFeatureExtractor, AutoModelForImageClassification
2 | import torch
3 |
4 | # load and save the extractor
5 | extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224")
6 | torch.save(extractor, "model/extractor.pt")
7 |
8 | # load and save the model
9 | model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224")
10 | torch.save(model, "model/model.pt")
--------------------------------------------------------------------------------
/models/sentiment-de/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import AutoTokenizer, AutoModelForSequenceClassification
2 | import torch
3 |
4 | # load and save bert model
5 | model = AutoModelForSequenceClassification.from_pretrained("oliverguhr/german-sentiment-bert")
6 | torch.save(model, "model/bert.pt")
7 |
8 | # load and save bert tokenizer
9 | tokenizer = AutoTokenizer.from_pretrained("oliverguhr/german-sentiment-bert")
10 | torch.save(tokenizer, "model/bert-tokenizer.pt")
--------------------------------------------------------------------------------
/apps/web/lib/apiKeys.ts:
--------------------------------------------------------------------------------
1 | import { WEBAPP_URL } from "@cargoship/lib/constants";
2 | import { headers } from "next/headers";
3 |
4 | export async function getApiKeys() {
5 | const cookie = headers().get("cookie") || "";
6 | const res = await fetch(`${WEBAPP_URL}/api/users/me/api-keys`, {
7 | headers: {
8 | cookie,
9 | },
10 | });
11 |
12 | if (!res.ok) {
13 | throw new Error("Failed to fetch data");
14 | }
15 |
16 | return res.json();
17 | }
18 |
--------------------------------------------------------------------------------
/apps/web/lib/memberships.ts:
--------------------------------------------------------------------------------
1 | import { WEBAPP_URL } from "@cargoship/lib/constants";
2 | import { headers } from "next/headers";
3 |
4 | export async function getMemberships() {
5 | const cookie = headers().get("cookie") || "";
6 | const res = await fetch(`${WEBAPP_URL}/api/memberships`, {
7 | headers: {
8 | cookie,
9 | },
10 | });
11 |
12 | if (!res.ok) {
13 | throw new Error("Failed to fetch data");
14 | }
15 |
16 | return res.json();
17 | }
18 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "ban.spellright", // Spell check for docs
4 | "bradlc.vscode-tailwindcss", // hinting / autocompletion for tailwind
5 | "DavidAnson.vscode-markdownlint", // markdown linting
6 | "dbaeumer.vscode-eslint", // eslint plugin
7 | "esbenp.prettier-vscode", // prettier plugin
8 | "Prisma.prisma", // VSCode support for prisma
9 | "yzhang.markdown-all-in-one" // better markdown support
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/docs/index.mdx:
--------------------------------------------------------------------------------
1 | import { Layout } from "@/components/docs/Layout";
2 | import Image from "next/image";
3 | import HeroExplainer from "@/images/hero-explainer.svg";
4 |
5 | export const meta = {
6 | title: "Cargoship - Open Source AI for your product",
7 | };
8 |
9 | Up-to-date, free & easy to use - We build AI for your product.
10 |
11 |
12 |
13 | export default ({ children }) => {children} ;
14 |
--------------------------------------------------------------------------------
/apps/demo/lib/detectLanguage.ts:
--------------------------------------------------------------------------------
1 | export const detectLanguage = async (text: string): Promise => {
2 | const response = await fetch("/api/detect-language", {
3 | method: "POST",
4 | headers: {
5 | "Content-Type": "application/json",
6 | },
7 | body: JSON.stringify({ text }),
8 | });
9 | if (!response.ok) {
10 | throw Error("Detect Language API error");
11 | }
12 | const { language } = await response.json();
13 | return language;
14 | };
15 |
--------------------------------------------------------------------------------
/apps/demo/components/LayoutApp.tsx:
--------------------------------------------------------------------------------
1 | import Sidebar from "./Sidebar";
2 |
3 | export default function LayoutApp({ children }: { children: React.ReactNode }) {
4 | return (
5 |
6 | {/* Static sidebar for desktop */}
7 |
8 |
9 |
10 |
{children}
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/models/sentiment-en/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import AutoTokenizer, AutoModelForSequenceClassification
2 | import torch
3 |
4 | # load and save bert model
5 | model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
6 | torch.save(model, "model/roberta.pt")
7 |
8 | # load and save bert tokenizer
9 | tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
10 | torch.save(tokenizer, "model/roberta-tokenizer.pt")
--------------------------------------------------------------------------------
/packages/eslint-config-cargoship/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "eslint-config-cargoship",
3 | "version": "1.0.0",
4 | "private": true,
5 | "main": "index.js",
6 | "license": "MIT",
7 | "dependencies": {
8 | "eslint": "^8.26.0",
9 | "eslint-config-next": "^13.0.0",
10 | "eslint-config-prettier": "^8.5.0",
11 | "eslint-plugin-react": "7.31.10",
12 | "eslint-config-turbo": "latest"
13 | },
14 | "devDependencies": {
15 | "typescript": "^4.8.4"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | postgres:
4 | image: postgres:15-alpine
5 | volumes:
6 | - postgres:/var/lib/postgresql/data
7 | environment:
8 | - POSTGRES_PASSWORD=postgres
9 |
10 | cargoship:
11 | build:
12 | context: .
13 | dockerfile: ./apps/web/Dockerfile
14 | depends_on:
15 | - postgres
16 | ports:
17 | - 3000:3000
18 | env_file:
19 | - .env
20 |
21 | volumes:
22 | postgres:
23 | driver: local
24 |
--------------------------------------------------------------------------------
/apps/web/app/auth/forgot-password/reset/success/page.tsx:
--------------------------------------------------------------------------------
1 | import BackToLoginButton from "@/components/auth/BackToLoginButton";
2 |
3 | export default function ResetPasswordSuccessPage() {
4 | return (
5 |
6 |
Password successfully reset
7 |
You can now log in with your new password
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/models/image-captioning/app/image.py:
--------------------------------------------------------------------------------
1 | from app.api import Input
2 | from PIL import Image
3 | import requests
4 | from io import BytesIO
5 | import base64
6 |
7 | def getImage(input: Input) -> Image:
8 | if (input.imageUrl):
9 | url = input.imageUrl
10 | return Image.open(requests.get(url, stream=True).raw)
11 | elif (input.base64):
12 | base64Image = input.base64
13 | return Image.open(BytesIO(base64.b64decode(base64Image)))
14 | else:
15 | raise Exception("No image provided")
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/image.py:
--------------------------------------------------------------------------------
1 | from app.api import Input
2 | from PIL import Image
3 | import requests
4 | from io import BytesIO
5 | import base64
6 |
7 | def getImage(input: Input) -> Image:
8 | if (input.imageUrl):
9 | url = input.imageUrl
10 | return Image.open(requests.get(url, stream=True).raw)
11 | elif (input.base64):
12 | base64Image = input.base64
13 | return Image.open(BytesIO(base64.b64decode(base64Image)))
14 | else:
15 | raise Exception("No image provided")
--------------------------------------------------------------------------------
/apps/web/app/auth/verify/page.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { SignIn } from "@/components/auth/SignIn";
4 | import { useSearchParams } from "next/navigation";
5 |
6 | export default function Verify() {
7 | const searchParams = useSearchParams();
8 | return searchParams && searchParams?.get("token") ? (
9 |
10 |
Verifying...
11 |
12 |
13 | ) : (
14 | No Token provided
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | **/node_modules
5 | .pnp
6 | .pnp.js
7 | .pnpm-store/
8 |
9 | # testing
10 | coverage
11 |
12 | # next.js
13 | **/.next
14 | **/out
15 | **/build
16 |
17 | # node
18 | **/dist
19 |
20 | # misc
21 | .DS_Store
22 | *.pem
23 |
24 | # debug
25 | npm-debug.log*
26 | yarn-debug.log*
27 | yarn-error.log*
28 |
29 | # turbo
30 | .turbo
31 |
32 | # nixos stuff
33 | .direnv
34 |
35 | .vscode
36 | .github
37 | **/.turbo
38 |
--------------------------------------------------------------------------------
/models/sentiment-de/app/sentiment_analysis.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/bert.pt")
10 | tokenizer = torch.load("model/bert-tokenizer.pt")
11 | return pipeline('sentiment-analysis', model=model,tokenizer=tokenizer)
12 |
13 |
14 | def predict_sentiment_request(input: Input, generator) -> Output:
15 | output = generator(input.text)
16 | return Output(sentiment = output[0]["label"])
--------------------------------------------------------------------------------
/models/text-generation-en-lg/app/text_generation.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/model.pt")
10 | tokenizer = torch.load("model/tokenizer.pt")
11 | return pipeline('text-generation', model=model,tokenizer=tokenizer)
12 |
13 |
14 | def text_generation_request(input: Input, generator) -> Output:
15 | output = generator(input.text)
16 | return Output(text = output[0]["generated_text"])
--------------------------------------------------------------------------------
/models/text-generation-en-sm/app/text_generation.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/model.pt")
10 | tokenizer = torch.load("model/tokenizer.pt")
11 | return pipeline('text-generation', model=model,tokenizer=tokenizer)
12 |
13 |
14 | def text_generation_request(input: Input, generator) -> Output:
15 | output = generator(input.text)
16 | return Output(text = output[0]["generated_text"])
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "short_name": "",
4 | "icons": [
5 | {
6 | "src": "/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/apps/demo/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 | .pnpm-debug.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
34 | # typescript
35 | *.tsbuildinfo
36 | next-env.d.ts
37 |
--------------------------------------------------------------------------------
/apps/demo/lib/storage.ts:
--------------------------------------------------------------------------------
1 | interface Feedback {
2 | feedback: string;
3 | sentiment: string;
4 | createdAt: string;
5 | }
6 |
7 | export const addFeedbackToLocalStorage = (feedback: Feedback) => {
8 | const feedbacks = getFeedbacksFromLocalStorage();
9 | feedbacks.push(feedback);
10 | localStorage.setItem("demo-feedbacks", JSON.stringify(feedbacks));
11 | };
12 |
13 | export const getFeedbacksFromLocalStorage = (): Feedback[] => {
14 | const feedbacks = localStorage.getItem("demo-feedbacks");
15 | return feedbacks ? JSON.parse(feedbacks) : [];
16 | };
17 |
--------------------------------------------------------------------------------
/apps/web/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env
29 | .env.local
30 | .env.development.local
31 | .env.test.local
32 | .env.production.local
33 |
34 | # vercel
35 | .vercel
36 |
--------------------------------------------------------------------------------
/apps/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@cargoship/tsconfig/nextjs.json",
3 | "include": [
4 | "next-env.d.ts",
5 | "**/*.ts",
6 | "**/*.tsx",
7 | ".next/types/**/*.ts"
8 | ],
9 | "exclude": [
10 | "node_modules"
11 | ],
12 | "compilerOptions": {
13 | "baseUrl": ".",
14 | "paths": {
15 | /* "@ui/*": ["../../packages/ui/src/*"], */
16 | "@/*": [
17 | "./*"
18 | ]
19 | },
20 | "plugins": [
21 | {
22 | "name": "next"
23 | }
24 | ],
25 | "strictNullChecks": true
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/apps/web/app/auth/signup-without-verification-success/page.tsx:
--------------------------------------------------------------------------------
1 | import BackToLoginButton from "@/components/auth/BackToLoginButton";
2 |
3 | export default function SignupWithoutVerificationSuccess() {
4 | return (
5 |
6 |
User successfully created
7 |
8 | Your new user has been created successfully. Please click the button below and sign in to your
9 | account.
10 |
11 |
12 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/models/summarization-en/app/text_summarization.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/bart.pt")
10 | tokenizer = torch.load("model/bart-tokenizer.pt")
11 | return pipeline('summarization', model=model,tokenizer=tokenizer)
12 |
13 |
14 | def summarize(input: Input, generator) -> Output:
15 | output = generator(input.text, max_length=100, min_length=30, do_sample=False)
16 | print(output[0])
17 | return Output(text = output[0]['summary_text'])
--------------------------------------------------------------------------------
/apps/web/app/auth/login/page.tsx:
--------------------------------------------------------------------------------
1 | import { SigninForm } from "@/components/auth/SigninForm";
2 | import Link from "next/link";
3 |
4 | export default function SignInPage() {
5 | return (
6 |
7 |
8 | {process.env.NEXT_PUBLIC_SIGNUP_DISABLED !== "1" && (
9 |
10 |
13 | Create an account
14 |
15 |
16 | )}
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/apps/demo/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | async redirects() {
5 | return [
6 | {
7 | source: "/",
8 | destination: "/app",
9 | permanent: false,
10 | },
11 | ];
12 | },
13 | images: {
14 | remotePatterns: [
15 | {
16 | protocol: "https",
17 | hostname: "tailwindui.com",
18 | },
19 | {
20 | protocol: "https",
21 | hostname: "images.unsplash.com",
22 | },
23 | ],
24 | },
25 | };
26 |
27 | module.exports = nextConfig;
28 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 | .pnpm-debug.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
34 | # typescript
35 | *.tsbuildinfo
36 | next-env.d.ts
37 |
38 | .vscode
39 |
40 | public/sitemap*.xml
41 |
--------------------------------------------------------------------------------
/apps/web/app/auth/forgot-password/email-sent/page.tsx:
--------------------------------------------------------------------------------
1 | import BackToLoginButton from "@/components/auth/BackToLoginButton";
2 |
3 | export default function SignInPage() {
4 | return (
5 |
6 |
Password reset successfully requested
7 |
8 | Check your email for a link to reset your password. If it doesn't appear within a few minutes,
9 | check your spam folder.
10 |
11 |
12 |
13 |
14 |
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/apps/web/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import ToasterClient from "@/components/ToasterClient";
2 | import { PosthogClientWrapper } from "./PosthogClient";
3 | import "./globals.css";
4 |
5 | export const metadata = {
6 | title: "Cargoship",
7 | description: "In-Product Survey Platform",
8 | };
9 |
10 | export default function RootLayout({ children }: { children: React.ReactNode }) {
11 | return (
12 |
13 |
14 | {children}
15 |
16 |
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/models/language-detection/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.language_detection import handle_detect_language_request
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | @app.post("/")
18 | async def detect_language(input: Input) -> Output:
19 | return handle_detect_language_request(input)
20 |
--------------------------------------------------------------------------------
/packages/tsconfig/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Default",
4 | "compilerOptions": {
5 | "composite": false,
6 | "declaration": true,
7 | "declarationMap": true,
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "inlineSources": false,
11 | "isolatedModules": true,
12 | "moduleResolution": "node",
13 | "noUnusedLocals": false,
14 | "noUnusedParameters": false,
15 | "preserveWatchOutput": true,
16 | "skipLibCheck": true,
17 | "strict": true
18 | },
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/.github/workflows/checks.yml:
--------------------------------------------------------------------------------
1 | name: Checks
2 | on: [push]
3 | jobs:
4 | build:
5 | name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
6 | runs-on: ubuntu-latest
7 |
8 | steps:
9 | - name: Checkout repo
10 | uses: actions/checkout@v2
11 |
12 | - name: Setup Node.js 16.x
13 | uses: actions/setup-node@v2
14 | with:
15 | node-version: 16.x
16 |
17 | - name: Install pnpm
18 | uses: pnpm/action-setup@v2.2.2
19 |
20 | - name: Install dependencies
21 | run: pnpm install
22 |
23 | - name: Lint
24 | run: pnpm lint
25 |
--------------------------------------------------------------------------------
/apps/demo/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/sentiment-en/app/sentiment_analysis.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/roberta.pt")
10 | tokenizer = torch.load("model/roberta-tokenizer.pt")
11 | return pipeline('sentiment-analysis', model=model,tokenizer=tokenizer)
12 |
13 |
14 | def predict_sentiment_request(input: Input, generator) -> Output:
15 | labels=['negative', 'neutral', 'positive']
16 | output = generator(input.text)
17 | labelIdx = int(output[0]['label'][-1])
18 | return Output(sentiment = labels[labelIdx])
--------------------------------------------------------------------------------
/docker-compose.dev.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 | services:
3 | postgres:
4 | image: postgres:15-alpine
5 | volumes:
6 | - postgres-cargoship:/var/lib/postgresql/data
7 | environment:
8 | - POSTGRES_DB=postgres
9 | - POSTGRES_USER=postgres
10 | - POSTGRES_PASSWORD=postgres
11 | ports:
12 | - 5432:5432
13 |
14 | mailhog:
15 | image: mailhog/mailhog
16 | # network_mode: service:app
17 | logging:
18 | driver: "none" # disable saving logs
19 | ports:
20 | - 8025:8025 # web ui
21 | - 1025:1025 # smtp server
22 |
23 | volumes:
24 | postgres-cargoship:
25 | driver: local
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 | .pnp
6 | .pnp.js
7 |
8 | # testing
9 | coverage
10 |
11 | # next.js
12 | .next/
13 | out/
14 | build
15 |
16 | # node
17 | dist/
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 |
23 | # debug
24 | npm-debug.log*
25 | yarn-debug.log*
26 | yarn-error.log*
27 |
28 | # local env files
29 | .env
30 | .env.local
31 | .env.development.local
32 | .env.test.local
33 | .env.production.local
34 | !packages/database/.env
35 |
36 | # turbo
37 | .turbo
38 | .Rproj.user
39 |
40 | docker/projects
41 | docker/traefik/acme.json
42 |
--------------------------------------------------------------------------------
/models/summarization-en/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.text_summarization import get_generator, summarize
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | generator = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def detect_language(input: Input) -> Output:
21 | return summarize(input, generator)
--------------------------------------------------------------------------------
/models/image-generation-sd/app/predict.py:
--------------------------------------------------------------------------------
1 | from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
2 | import torch
3 | from fastapi import Response
4 | from io import BytesIO
5 |
6 | model_id = "stabilityai/stable-diffusion-2-1-base"
7 |
8 | def get_diffuser():
9 | model = torch.load("model/model.pt")
10 | return(model)
11 |
12 | def predict(prompt: str, neg_prompt: str, model) -> Response:
13 | image = model(prompt = prompt, negative_prompt= neg_prompt).images[0]
14 |
15 | img_byte_arr = BytesIO()
16 | image.save(img_byte_arr, format='PNG')
17 | return Response(content = img_byte_arr.getvalue(), media_type="image/png")
18 |
--------------------------------------------------------------------------------
/apps/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "paths": {
18 | "@/*": ["./*"]
19 | }
20 | },
21 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
22 | "exclude": ["node_modules"]
23 | }
24 |
--------------------------------------------------------------------------------
/apps/web/components/ui/Code.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { Copy } from "lucide-react";
4 | import toast from "react-hot-toast";
5 |
6 | export function Code({ code }) {
7 | return (
8 |
9 |
{
12 | navigator.clipboard.writeText(code);
13 | toast.success("URL copied to clipboard");
14 | }}>
15 |
16 |
17 |
{code}
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.predict import get_generator, predict
6 | import torch
7 |
8 | app = FastAPI(dependencies=[Depends(get_api_key)])
9 |
10 | app.add_middleware(
11 | CORSMiddleware,
12 | allow_origins=['*'],
13 | allow_credentials=True,
14 | allow_methods=["*"],
15 | allow_headers=["*"],
16 | )
17 | (processor, model) = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def make_prediction(input: Input) -> Output:
21 | return predict(input, processor, model)
--------------------------------------------------------------------------------
/packages/lib/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/lib",
3 | "private": true,
4 | "sideEffects": false,
5 | "version": "0.0.0",
6 | "main": "./index.ts",
7 | "types": "./index.ts",
8 | "license": "MIT",
9 | "scripts": {
10 | "lint": "eslint . --ext .ts,.js,.tsx,.jsx",
11 | "lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
12 | "lint:report": "eslint . --format json --output-file ../../lint-results/app-store.json"
13 | },
14 | "dependencies": {},
15 | "devDependencies": {
16 | "@cargoship/tsconfig": "*",
17 | "eslint": "^8.27.0",
18 | "eslint-config-cargoship": "workspace:*",
19 | "typescript": "^4.9.4"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/models/image-captioning/app/save_model.py:
--------------------------------------------------------------------------------
1 | from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
2 | import torch
3 |
4 | # load and save the tokenizer
5 | tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
6 | torch.save(tokenizer, "model/tokenizer.pt")
7 |
8 | # load and save feature extractor
9 | feature_extractor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
10 | torch.save(feature_extractor, "model/feature_extractor.pt")
11 |
12 | # load and save the model
13 | model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
14 | torch.save(model, "model/model.pt")
--------------------------------------------------------------------------------
/models/language-detection/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | language: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 |
17 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
18 | if api_key_header != os.environ['API_KEY']:
19 | raise HTTPException(
20 | status_code=status.HTTP_401_UNAUTHORIZED,
21 | detail="Invalid API Key",
22 | )
--------------------------------------------------------------------------------
/models/sentiment-de/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.sentiment_analysis import get_generator, predict_sentiment_request
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | generator = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def detect_language(input: Input) -> Output:
21 | return predict_sentiment_request(input, generator)
--------------------------------------------------------------------------------
/models/sentiment-en/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.sentiment_analysis import get_generator, predict_sentiment_request
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | generator = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def detect_language(input: Input) -> Output:
21 | return predict_sentiment_request(input, generator)
--------------------------------------------------------------------------------
/models/text-generation-en-lg/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.text_generation import get_generator, text_generation_request
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | generator = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def detect_language(input: Input) -> Output:
21 | return text_generation_request(input, generator)
--------------------------------------------------------------------------------
/models/text-generation-en-sm/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.text_generation import get_generator, text_generation_request
6 |
7 | app = FastAPI(dependencies=[Depends(get_api_key)])
8 |
9 | app.add_middleware(
10 | CORSMiddleware,
11 | allow_origins=['*'],
12 | allow_credentials=True,
13 | allow_methods=["*"],
14 | allow_headers=["*"],
15 | )
16 |
17 | generator = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def detect_language(input: Input) -> Output:
21 | return text_generation_request(input, generator)
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/predict.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 | def get_generator():
7 | # load model
8 | model = torch.load("model/model.pt")
9 | processor = torch.load("model/processor.pt")
10 | return (processor, model)
11 |
12 |
13 | def predict(input, processor, model) -> Output:
14 | input_features = processor(input["array"], sampling_rate = input["sampling_rate"], return_tensors="pt").input_features
15 | predicted_ids = model.generate(input_features)
16 | transcription = processor.batch_decode(predicted_ids, skip_special_tokens = True)
17 | return Output(caption = transcription)
--------------------------------------------------------------------------------
/apps/web/app/page.tsx:
--------------------------------------------------------------------------------
1 | import { getMemberships } from "@/lib/memberships";
2 | import { getServerSession } from "next-auth";
3 | import { redirect } from "next/navigation";
4 | import { authOptions } from "./api/auth/[...nextauth]/authOptions";
5 |
6 | export default async function HomePage() {
7 | const session = await getServerSession(authOptions);
8 |
9 | if (!session) {
10 | redirect(`/auth/login`);
11 | }
12 |
13 | const memberships = await getMemberships();
14 |
15 | if (memberships && memberships.length > 0) {
16 | const teamId = memberships[0].teamId;
17 | redirect(`/teams/${teamId}/apis`);
18 | }
19 |
20 | return Something went wrong...
;
21 | }
22 |
--------------------------------------------------------------------------------
/apps/web/app/teams/[teamId]/layout.tsx:
--------------------------------------------------------------------------------
1 | import { authOptions } from "@/app/api/auth/[...nextauth]/authOptions";
2 | import { getServerSession } from "next-auth";
3 | import { redirect } from "next/navigation";
4 | import Navbar from "./Navbar";
5 | import PosthogIdentify from "@/app/PosthogIdentify";
6 |
7 | export default async function LayoutApp({ children, params }) {
8 | const session = await getServerSession(authOptions);
9 |
10 | if (!session) {
11 | redirect(`/auth/login`);
12 | }
13 |
14 | return (
15 |
16 |
17 |
18 | {children}
19 |
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/apps/web/lib/jwt.ts:
--------------------------------------------------------------------------------
1 | import jwt from "jsonwebtoken";
2 | import { prisma } from "@cargoship/database";
3 |
4 | export function createToken(userId, userEmail, options = {}) {
5 | return jwt.sign({ id: userId }, process.env.NEXTAUTH_SECRET + userEmail, options);
6 | }
7 |
8 | export async function verifyToken(token, userEmail = "") {
9 | if (!userEmail) {
10 | const { id } = jwt.decode(token);
11 |
12 | const foundUser = await prisma.user.findUnique({
13 | where: { id },
14 | });
15 |
16 | if (!foundUser) {
17 | return null;
18 | }
19 |
20 | userEmail = foundUser.email;
21 | }
22 |
23 | return jwt.verify(token, process.env.NEXTAUTH_SECRET + userEmail);
24 | }
25 |
--------------------------------------------------------------------------------
/models/image-classification/app/predict.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 |
7 | def get_generator():
8 | # load model
9 | model = torch.load("model/model.pt")
10 | extractor = torch.load("model/extractor.pt")
11 | return (extractor, model)
12 |
13 |
14 | def predict(image, extractor, model) -> Output:
15 | inputs = extractor(images=image, return_tensors="pt")
16 | outputs = model(**inputs)
17 | logits = outputs.logits
18 | # model predicts one of the 1000 ImageNet classes
19 | predicted_class_idx = logits.argmax(-1).item()
20 | return Output(prediction = model.config.id2label[predicted_class_idx])
--------------------------------------------------------------------------------
/packages/tsconfig/nextjs.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Next.js",
4 | "extends": "./base.json",
5 | "compilerOptions": {
6 | "target": "es5",
7 | "lib": ["DOM", "DOM.iterable", "ESNext"],
8 | "allowJs": true,
9 | "skipLibCheck": true,
10 | "strict": false,
11 | "forceConsistentCasingInFileNames": true,
12 | "noEmit": true,
13 | "incremental": true,
14 | "esModuleInterop": true,
15 | "module": "esnext",
16 | "resolveJsonModule": true,
17 | "isolatedModules": true,
18 | "jsx": "preserve"
19 | },
20 | "include": ["**/*.ts", "**/*.tsx", "next-env.d.ts"],
21 | "exclude": ["node_modules"]
22 | }
23 |
--------------------------------------------------------------------------------
/apps/web/app/PosthogIdentify.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 | import type { Session } from "next-auth";
3 | import { usePostHog } from "posthog-js/react";
4 | import { useEffect } from "react";
5 |
6 | const posthogEnabled = process.env.NEXT_PUBLIC_POSTHOG_API_KEY && process.env.NEXT_PUBLIC_POSTHOG_API_HOST;
7 |
8 | export default function PosthogIdentify({ session }: { session: Session }) {
9 | const posthog = usePostHog();
10 |
11 | useEffect(() => {
12 | if (posthogEnabled && session.user && posthog) {
13 | posthog.identify(session.user.id);
14 | if (session.user.teamId) {
15 | posthog?.group("team", session.user.teamId);
16 | }
17 | }
18 | }, [session, posthog]);
19 |
20 | return null;
21 | }
22 |
--------------------------------------------------------------------------------
/models/image-generation-sd/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | prompt: str
10 | neg_prompt: str = None
11 |
12 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
13 |
14 | if (not os.environ.get('API_KEY')):
15 | raise Exception("API_KEY not set")
16 |
17 |
18 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
19 | if api_key_header != os.environ.get('API_KEY'):
20 | raise HTTPException(
21 | status_code=status.HTTP_401_UNAUTHORIZED,
22 | detail="Invalid API Key",
23 | )
--------------------------------------------------------------------------------
/apps/cargoship-sh/lib/articles.ts:
--------------------------------------------------------------------------------
1 | import glob from "fast-glob";
2 | import * as path from "path";
3 |
4 | async function importArticle(articleFilename: string) {
5 | let { meta, default: component } = await import(`../pages/blog/${articleFilename}`);
6 | return {
7 | slug: articleFilename.replace(/(\/index)?\.mdx$/, ""),
8 | ...meta,
9 | component,
10 | };
11 | }
12 |
13 | export async function getAllArticles() {
14 | let articleFilenames = await glob(["*.mdx", "*/index.mdx"], {
15 | cwd: path.join(process.cwd(), "pages/blog"),
16 | });
17 |
18 | let articles = await Promise.all(articleFilenames.map(importArticle));
19 |
20 | return articles.sort((a, z) => new Date(z.date).valueOf() - new Date(a.date).valueOf());
21 | }
22 |
--------------------------------------------------------------------------------
/apps/web/components/auth/GithubButton.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { Button } from "@/components/ui/Button";
4 | import { signIn } from "next-auth/react";
5 | import { FaGithub } from "react-icons/fa";
6 |
7 | export const GithubButton = ({ text = "Login with Github" }) => {
8 | const handleLogin = async () => {
9 | await signIn("github", {
10 | redirect: true,
11 | callbackUrl: "/", // redirect after login to /
12 | });
13 | };
14 |
15 | return (
16 |
23 | {text}
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/models/sentiment-de/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | sentiment: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 | if (not os.environ.get('API_KEY')):
17 | raise Exception("API_KEY not set")
18 |
19 |
20 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
21 | if api_key_header != os.environ.get('API_KEY'):
22 | raise HTTPException(
23 | status_code=status.HTTP_401_UNAUTHORIZED,
24 | detail="Invalid API Key",
25 | )
--------------------------------------------------------------------------------
/models/sentiment-en/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | sentiment: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 | if (not os.environ.get('API_KEY')):
17 | raise Exception("API_KEY not set")
18 |
19 |
20 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
21 | if api_key_header != os.environ.get('API_KEY'):
22 | raise HTTPException(
23 | status_code=status.HTTP_401_UNAUTHORIZED,
24 | detail="Invalid API Key",
25 | )
--------------------------------------------------------------------------------
/models/summarization-en/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | text: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 | if (not os.environ.get('API_KEY')):
17 | raise Exception("API_KEY not set")
18 |
19 |
20 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
21 | if api_key_header != os.environ.get('API_KEY'):
22 | raise HTTPException(
23 | status_code=status.HTTP_401_UNAUTHORIZED,
24 | detail="Invalid API Key",
25 | )
--------------------------------------------------------------------------------
/models/text-generation-en-lg/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | text: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 | if (not os.environ.get('API_KEY')):
17 | raise Exception("API_KEY not set")
18 |
19 |
20 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
21 | if api_key_header != os.environ.get('API_KEY'):
22 | raise HTTPException(
23 | status_code=status.HTTP_401_UNAUTHORIZED,
24 | detail="Invalid API Key",
25 | )
--------------------------------------------------------------------------------
/models/text-generation-en-sm/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | text: str
10 |
11 | class Output(BaseModel):
12 | text: str
13 |
14 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
15 |
16 | if (not os.environ.get('API_KEY')):
17 | raise Exception("API_KEY not set")
18 |
19 |
20 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
21 | if api_key_header != os.environ.get('API_KEY'):
22 | raise HTTPException(
23 | status_code=status.HTTP_401_UNAUTHORIZED,
24 | detail="Invalid API Key",
25 | )
--------------------------------------------------------------------------------
/models/image-generation-sd/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI, Response
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, get_api_key
5 | from app.predict import get_diffuser, predict
6 | import torch
7 |
8 | app = FastAPI(dependencies=[Depends(get_api_key)])
9 |
10 | app.add_middleware(
11 | CORSMiddleware,
12 | allow_origins=['*'],
13 | allow_credentials=True,
14 | allow_methods=["*"],
15 | allow_headers=["*"],
16 | )
17 | model = get_diffuser() # load model
18 |
19 | model.to("cuda")
20 |
21 | @app.post("/", responses = {200: {"content" : {"image/png": {}}}}, response_class = Response)
22 | async def make_prediction(input: Input) -> Response:
23 | return predict(input.prompt, input.neg_prompt, model)
--------------------------------------------------------------------------------
/models/image-generation-sd/requirements.txt:
--------------------------------------------------------------------------------
1 | accelerate==0.17.0
2 | anyio==3.6.2
3 | certifi==2022.12.7
4 | charset-normalizer==3.1.0
5 | click==8.1.3
6 | colorama==0.4.6
7 | diffusers==0.14.0
8 | fastapi==0.95.0
9 | filelock==3.9.0
10 | h11==0.14.0
11 | huggingface-hub==0.13.1
12 | idna==3.4
13 | importlib-metadata==6.0.0
14 | numpy==1.24.2
15 | packaging==23.0
16 | Pillow==9.4.0
17 | psutil==5.9.4
18 | pydantic==1.10.7
19 | PyYAML==6.0
20 | regex==2022.10.31
21 | requests==2.28.2
22 | safetensors==0.3.0
23 | scipy==1.10.1
24 | sniffio==1.3.0
25 | starlette==0.26.1
26 | tokenizers==0.13.2
27 | torch==1.13.1
28 | torchaudio==0.13.1
29 | torchvision==0.14.1
30 | tqdm==4.65.0
31 | transformers==4.26.1
32 | typing_extensions==4.5.0
33 | urllib3==1.26.14
34 | uvicorn==0.21.1
35 | zipp==3.15.0
36 |
--------------------------------------------------------------------------------
/models/image-captioning/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | base64: str = None
10 | imageUrl: str = None
11 |
12 | class Output(BaseModel):
13 | caption: str
14 |
15 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
16 |
17 | if (not os.environ.get('API_KEY')):
18 | raise Exception("API_KEY not set")
19 |
20 |
21 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
22 | if api_key_header != os.environ.get('API_KEY'):
23 | raise HTTPException(
24 | status_code=status.HTTP_401_UNAUTHORIZED,
25 | detail="Invalid API Key",
26 | )
--------------------------------------------------------------------------------
/models/whisper-tiny-en/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | base64: str = None
10 | imageUrl: str = None
11 |
12 | class Output(BaseModel):
13 | caption: str
14 |
15 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
16 |
17 | if (not os.environ.get('API_KEY')):
18 | raise Exception("API_KEY not set")
19 |
20 |
21 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
22 | if api_key_header != os.environ.get('API_KEY'):
23 | raise HTTPException(
24 | status_code=status.HTTP_401_UNAUTHORIZED,
25 | detail="Invalid API Key",
26 | )
--------------------------------------------------------------------------------
/apps/cargoship-sh/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "baseUrl": ".",
23 | "paths": {
24 | "@/*": ["./*"]
25 | }
26 | },
27 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
28 | "exclude": ["node_modules"]
29 | }
30 |
--------------------------------------------------------------------------------
/models/image-classification/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | base64: str = None
10 | url: str = None
11 |
12 | class Output(BaseModel):
13 | prediction: str
14 |
15 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
16 |
17 | if (not os.environ.get('API_KEY')):
18 | raise Exception("API_KEY not set")
19 |
20 |
21 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
22 | if api_key_header != os.environ.get('API_KEY'):
23 | raise HTTPException(
24 | status_code=status.HTTP_401_UNAUTHORIZED,
25 | detail="Invalid API Key",
26 | )
--------------------------------------------------------------------------------
/models/image-generation-sd/requirements_windows.txt:
--------------------------------------------------------------------------------
1 | accelerate==0.18.0
2 | anyio==3.6.2
3 | certifi==2022.12.7
4 | charset-normalizer==3.1.0
5 | click==8.1.3
6 | colorama==0.4.6
7 | diffusers==0.14.0
8 | fastapi==0.95.0
9 | filelock==3.9.0
10 | h11==0.14.0
11 | huggingface-hub==0.13.1
12 | idna==3.4
13 | importlib-metadata==6.0.0
14 | numpy==1.24.2
15 | packaging==23.0
16 | Pillow==9.4.0
17 | psutil==5.9.4
18 | pydantic==1.10.7
19 | PyYAML==6.0
20 | regex==2022.10.31
21 | requests==2.28.2
22 | safetensors==0.3.0
23 | scipy==1.10.1
24 | sniffio==1.3.0
25 | starlette==0.26.1
26 | tokenizers==0.13.2
27 | torch==1.13.1+cu117
28 | torchaudio==0.13.1+cu117
29 | torchvision==0.14.1+cu117
30 | tqdm==4.65.0
31 | transformers==4.26.1
32 | typing_extensions==4.5.0
33 | urllib3==1.26.14
34 | uvicorn==0.21.1
35 | zipp==3.15.0
36 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/api.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from fastapi import Depends, HTTPException
4 | from fastapi.security import APIKeyHeader
5 | from pydantic import BaseModel
6 | from starlette import status
7 |
8 | class Input(BaseModel):
9 | base64: str = None
10 | imageUrl: str = None
11 |
12 | class Output(BaseModel):
13 | caption: str
14 |
15 | api_key_header_auth = APIKeyHeader(name="X-API-Key", auto_error=True)
16 |
17 | if (not os.environ.get('API_KEY')):
18 | raise Exception("API_KEY not set")
19 |
20 |
21 | def get_api_key(api_key_header: str = Depends(api_key_header_auth)):
22 | if api_key_header != os.environ.get('API_KEY'):
23 | raise HTTPException(
24 | status_code=status.HTTP_401_UNAUTHORIZED,
25 | detail="Invalid API Key",
26 | )
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/predict.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 | max_length = 16
7 | num_beams = 4
8 | gen_kwargs = {"max_length": max_length, "num_beams": num_beams}
9 |
10 |
11 | def get_generator():
12 | # load model
13 | model = torch.load("model/model.pt")
14 | processor = torch.load("model/processor.pt")
15 | return (processor, model)
16 |
17 |
18 | def predict(image, processor, model, device) -> Output:
19 | pixel_values = processor(image, return_tensors="pt").pixel_values
20 | pixel_values = pixel_values.to(device)
21 | generated_ids = model.generate(pixel_values)
22 | generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
23 | return Output(caption = generated_text)
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/layout/Layout.tsx:
--------------------------------------------------------------------------------
1 | import Footer from "../shared/Footer";
2 | import MetaInformation from "../shared/MetaInformation";
3 | import Navbar from "./Navbar";
4 |
5 | interface LayoutProps {
6 | children: React.ReactNode;
7 | title: string;
8 | description: string;
9 | }
10 |
11 | export default function Layout({ title, description, children }: LayoutProps) {
12 | return (
13 |
14 |
15 |
16 | {
17 |
18 | {children}
19 |
20 | }
21 |
22 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/DiscordCTA.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@cargoship/ui";
2 | import BackgroundGradient from "../home/BackgroundGradient";
3 |
4 | export function DiscordCTA() {
5 | return (
6 |
7 |
8 |
9 |
Need help?
10 |
11 | Join our Discord and ask away. We're happy to help where we can!
12 |
13 |
14 | Join Discord
15 |
16 |
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/models/image-classification/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI, HTTPException
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.predict import get_generator, predict
6 | from app.image import getImage
7 |
8 | app = FastAPI(dependencies=[Depends(get_api_key)])
9 |
10 | app.add_middleware(
11 | CORSMiddleware,
12 | allow_origins=['*'],
13 | allow_credentials=True,
14 | allow_methods=["*"],
15 | allow_headers=["*"],
16 | )
17 | (extractor, model) = get_generator() # load model
18 |
19 | @app.post("/")
20 | async def make_prediction(input: Input) -> Output:
21 | try:
22 | image = getImage(input)
23 | except Exception as e:
24 | raise HTTPException(status_code=400, detail=str(e))
25 | return predict(image, extractor, model)
--------------------------------------------------------------------------------
/apps/cargoship-sh/lib/docsNavigation.ts:
--------------------------------------------------------------------------------
1 | const navigation = [
2 | {
3 | title: "Introduction",
4 | links: [
5 | { title: "Why Cargoship?", href: "/docs/introduction/why-cargoship" },
6 | { title: "Your Benefits", href: "/docs/introduction/your-benefits" },
7 | ],
8 | },
9 | {
10 | title: "Basic Usage",
11 | links: [
12 | { title: "Basics", href: "/docs/basics/basics" },
13 | { title: "Quick Start", href: "/docs/basics/quickstart" },
14 | { title: "Deployment", href: "/docs/basics/deployment" },
15 | ],
16 | },
17 | {
18 | title: "Cloud",
19 | links: [
20 | { title: "Introduction", href: "/docs/cloud/introduction" },
21 | { title: "API Keys", href: "/docs/cloud/api-keys" },
22 | { title: "How to use", href: "/docs/cloud/how-to-use" },
23 | ],
24 | },
25 | ];
26 |
27 | export default navigation;
28 |
--------------------------------------------------------------------------------
/apps/web/pages/api/apis/index.ts:
--------------------------------------------------------------------------------
1 | import { getSessionOrUser } from "@/lib/apiHelper";
2 | import { prisma } from "@cargoship/database";
3 | import type { NextApiRequest, NextApiResponse } from "next";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // Check Authentication
7 | const user: any = await getSessionOrUser(req, res);
8 | if (!user) {
9 | return res.status(401).json({ message: "Not authenticated" });
10 | }
11 |
12 | // GET
13 | if (req.method === "GET") {
14 | const apis = await prisma.api.findMany({
15 | select: {
16 | id: true,
17 | name: true,
18 | description: true,
19 | },
20 | });
21 |
22 | return res.json(apis);
23 | }
24 |
25 | // Unknown HTTP Method
26 | else {
27 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/packages/tailwind-config/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | "./app/**/*.{js,ts,jsx,tsx}",
5 | "./pages/**/*.{js,ts,jsx,tsx}",
6 | "./components/**/*.{js,ts,jsx,tsx}",
7 |
8 | // include packages if not transpiling
9 | "../../packages/ui/src/**/*.{js,ts,jsx,tsx}",
10 | ],
11 | theme: {
12 | extend: {
13 | backgroundImage: {
14 | "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
15 | },
16 | colors: {
17 | brand: {
18 | DEFAULT: "#0ea5e9",
19 | light: "#38bdf8",
20 | dark: "#0284c7",
21 | },
22 | black: {
23 | DEFAULT: "#0F172A",
24 | },
25 | },
26 | maxWidth: {
27 | "8xl": "88rem",
28 | },
29 | },
30 | },
31 | plugins: [require("@tailwindcss/forms")],
32 | };
33 |
--------------------------------------------------------------------------------
/apps/web/lib/auth.ts:
--------------------------------------------------------------------------------
1 | import { compare, hash } from "bcryptjs";
2 |
3 | export async function hashPassword(password: string) {
4 | const hashedPassword = await hash(password, 12);
5 | return hashedPassword;
6 | }
7 |
8 | export async function verifyPassword(password: string, hashedPassword: string) {
9 | const isValid = await compare(password, hashedPassword);
10 | return isValid;
11 | }
12 | export function requireAuthentication(gssp) {
13 | return async (context) => {
14 | const { req, resolvedUrl } = context;
15 | const token = req.cookies.userToken;
16 |
17 | if (!token) {
18 | return {
19 | redirect: {
20 | destination: `/auth/login?callbackUrl=${encodeURIComponent(resolvedUrl)}`,
21 | statusCode: 302,
22 | },
23 | };
24 | }
25 |
26 | return await gssp(context); // Continue on to call `getServerSideProps` logic
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "turbo",
3 | "version": "0.0.0",
4 | "private": true,
5 | "workspaces": [
6 | "apps/*",
7 | "packages/*"
8 | ],
9 | "prisma": {
10 | "schema": "packages/database/prisma/schema.prisma"
11 | },
12 | "scripts": {
13 | "build": "turbo run build",
14 | "db:migrate:deploy": "turbo run db:migrate:deploy",
15 | "db:push": "turbo run db:push",
16 | "db:seed": "turbo run db:seed",
17 | "dev": "turbo run dev --parallel",
18 | "start": "turbo run start",
19 | "format": "prettier --write \"**/*.{ts,tsx,md}\"",
20 | "generate": "turbo run generate",
21 | "lint": "turbo run lint"
22 | },
23 | "devDependencies": {
24 | "prettier": "latest",
25 | "tsx": "^3.12.5",
26 | "turbo": "latest"
27 | },
28 | "engines": {
29 | "node": ">=14.0.0"
30 | },
31 | "dependencies": {},
32 | "packageManager": "pnpm@7.12.2"
33 | }
34 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.predict import get_generator, predict
6 | from app.image import getImage
7 | import torch
8 |
9 | app = FastAPI(dependencies=[Depends(get_api_key)])
10 |
11 | app.add_middleware(
12 | CORSMiddleware,
13 | allow_origins=['*'],
14 | allow_credentials=True,
15 | allow_methods=["*"],
16 | allow_headers=["*"],
17 | )
18 | (processor, model) = get_generator() # load model
19 |
20 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21 | model.to(device)
22 |
23 | @app.post("/")
24 | async def make_prediction(input: Input) -> Output:
25 | image = getImage(input)
26 | if image.mode != "RGB":
27 | image = image.convert(mode="RGB")
28 | return predict(image, processor, model, device)
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/API_CTA.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@cargoship/ui";
2 | import BackgroundGradient from "../home/BackgroundGradient";
3 |
4 | export function API_CTA() {
5 | return (
6 |
7 |
8 |
9 |
API
10 |
11 | If you don't want to implement the model all by yourself, no worries. Benefit from our easy to
12 | use API and get started right away!
13 |
14 |
15 | Get Started
16 |
17 |
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/models/image-captioning/app/predict.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from transformers import pipeline
3 |
4 | from app.api import Input, Output
5 |
6 | max_length = 16
7 | num_beams = 4
8 | gen_kwargs = {"max_length": max_length, "num_beams": num_beams}
9 |
10 |
11 | def get_generator():
12 | # load model
13 | model = torch.load("model/model.pt")
14 | tokenizer = torch.load("model/tokenizer.pt")
15 | feature_extractor = torch.load("model/feature_extractor.pt")
16 | return (tokenizer, feature_extractor, model)
17 |
18 |
19 | def predict(image, tokenizer, model, feature_extractor, device) -> Output:
20 | pixel_values = feature_extractor(images=[image], return_tensors="pt").pixel_values
21 | pixel_values = pixel_values.to(device)
22 | output_ids = model.generate(pixel_values, **gen_kwargs)
23 | preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
24 | preds = [pred.strip() for pred in preds]
25 | return Output(caption = preds[0])
--------------------------------------------------------------------------------
/apps/cargoship-sh/styles/prism.css:
--------------------------------------------------------------------------------
1 | pre[class*="language-"] {
2 | color: theme("colors.slate.50");
3 | }
4 |
5 | .token.tag,
6 | .token.class-name,
7 | .token.selector,
8 | .token.selector .class,
9 | .token.selector.class,
10 | .token.function {
11 | color: theme("colors.pink.400");
12 | }
13 |
14 | .token.attr-name,
15 | .token.keyword,
16 | .token.rule,
17 | .token.pseudo-class,
18 | .token.important {
19 | color: theme("colors.slate.300");
20 | }
21 |
22 | .token.module {
23 | color: theme("colors.pink.400");
24 | }
25 |
26 | .token.attr-value,
27 | .token.class,
28 | .token.string,
29 | .token.property {
30 | color: theme("colors.teal.400");
31 | }
32 |
33 | .token.punctuation,
34 | .token.attr-equals {
35 | color: theme("colors.slate.500");
36 | }
37 |
38 | .token.unit,
39 | .language-css .token.function {
40 | color: theme("colors.teal.200");
41 | }
42 |
43 | .token.comment,
44 | .token.operator,
45 | .token.combinator {
46 | color: theme("colors.slate.400");
47 | }
48 |
--------------------------------------------------------------------------------
/apps/web/components/auth/RequestVerificationEmail.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { Button } from "@/components/ui/Button";
4 | import { resendVerificationEmail } from "@/lib/users";
5 | import toast from "react-hot-toast";
6 |
7 | interface RequestEmailVerificationProps {
8 | email: string | null;
9 | }
10 |
11 | export const RequestVerificationEmail = ({ email }: RequestEmailVerificationProps) => {
12 | const requestVerificationEmail = async () => {
13 | try {
14 | if (!email) throw new Error("No email provided");
15 | await resendVerificationEmail(email);
16 | toast.success("Verification email successfully sent. Please check your inbox.");
17 | } catch (e) {
18 | toast.error(`Error: ${e.message}`);
19 | }
20 | };
21 | return (
22 | <>
23 |
24 | Request a new verification mail
25 |
26 | >
27 | );
28 | };
29 |
--------------------------------------------------------------------------------
/apps/web/lib/apis.ts:
--------------------------------------------------------------------------------
1 | import { WEBAPP_URL } from "@cargoship/lib/constants";
2 | import { headers } from "next/headers";
3 |
4 | export async function getApis() {
5 | const cookie = headers().get("cookie") || "";
6 | const res = await fetch(`${WEBAPP_URL}/api/apis`, {
7 | headers: {
8 | cookie,
9 | },
10 | });
11 |
12 | if (!res.ok) {
13 | throw new Error("Failed to fetch data");
14 | }
15 |
16 | return res.json();
17 | }
18 |
19 | export async function getApi(apiId: string) {
20 | const cookie = headers().get("cookie") || "";
21 | const res = await fetch(`${WEBAPP_URL}/api/apis/${apiId}`, {
22 | headers: {
23 | cookie,
24 | },
25 | });
26 |
27 | if (!res.ok) {
28 | throw new Error("Failed to fetch data");
29 | }
30 |
31 | const api = await res.json();
32 |
33 | // delete endpoint url from models from every api
34 | api.models.forEach((model) => {
35 | delete model.endpointUrl;
36 | });
37 |
38 | return api;
39 | }
40 |
--------------------------------------------------------------------------------
/apps/web/pages/api/memberships/index.ts:
--------------------------------------------------------------------------------
1 | import { getSessionOrUser } from "@/lib/apiHelper";
2 | import { prisma } from "@cargoship/database";
3 | import type { NextApiRequest, NextApiResponse } from "next";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // Check Authentication
7 | const session = await getSessionOrUser(req, res);
8 | if (!session || !session.email) {
9 | return res.status(401).json({ message: "Not authenticated" });
10 | }
11 |
12 | // GET /api/teams
13 | // Get all of my teams
14 | if (req.method === "GET") {
15 | const memberships = await prisma.membership.findMany({
16 | where: {
17 | user: { email: session.email },
18 | },
19 | include: {
20 | team: true,
21 | },
22 | });
23 | return res.json(memberships);
24 | }
25 |
26 | // Unknown HTTP Method
27 | else {
28 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/docs/basics/basics/index.mdx:
--------------------------------------------------------------------------------
1 | import { Layout } from "@/components/docs/Layout";
2 | import Image from "next/image";
3 | import { Callout } from "@/components/shared/Callout";
4 |
5 | export const meta = {
6 | title: "Basics",
7 | };
8 |
9 | To make it easy for you to get started and use our machine learning without having to worry about the technical details & machine learning technology stacks, we have wrapped the models in an easy-to-use API wrapper. This allows you to communicate with the machine learning model regardless of the technology stack you are using.
10 |
11 | The API wrapper is a simple REST API that you can use to make predictions. We package each model in a Docker container that you can use on your local machine and deploy to your servers. We distribute the underlying code as well as the containers as open source under the permissive MIT license on [GitHub](https://github.com/cargoshipsh/cargoship).
12 |
13 | export default ({ children }) => {children} ;
14 |
--------------------------------------------------------------------------------
/apps/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/demo",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev -p 3002",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@heroicons/react": "^2.0.17",
13 | "@types/node": "18.15.13",
14 | "@types/react": "18.0.37",
15 | "@types/react-dom": "18.0.11",
16 | "boring-avatars": "^1.7.0",
17 | "clsx": "^1.2.1",
18 | "eslint": "8.38.0",
19 | "eslint-config-cargoship": "workspace:*",
20 | "next": "13.3.0",
21 | "react": "18.2.0",
22 | "react-confetti": "^6.1.0",
23 | "react-dom": "18.2.0",
24 | "react-hook-form": "^7.43.9",
25 | "react-hot-toast": "^2.4.0",
26 | "react-use": "^17.4.0",
27 | "typescript": "5.0.4"
28 | },
29 | "devDependencies": {
30 | "@tailwindcss/forms": "^0.5.3",
31 | "autoprefixer": "^10.4.14",
32 | "postcss": "^8.4.23",
33 | "tailwindcss": "^3.3.1"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/apps/web/app/auth/signup/page.tsx:
--------------------------------------------------------------------------------
1 | import Link from "next/link";
2 | import { SignupForm } from "@/components/auth/SignupForm";
3 |
4 | export default function SignUpPage() {
5 | return (
6 |
7 | {process.env.NEXT_PUBLIC_SIGNUP_DISABLED === "1" ? (
8 | <>
9 |
Sign up disabled
10 |
11 | The account creation is disabled in this instance. Please contact the site administrator to create
12 | an account.
13 |
14 |
15 |
18 | Login
19 |
20 | >
21 | ) : (
22 |
23 | )}
24 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/docs/introduction/why-cargoship/index.mdx:
--------------------------------------------------------------------------------
1 | import { Layout } from "@/components/docs/Layout";
2 | import Image from "next/image";
3 | import { Callout } from "@/components/shared/Callout";
4 |
5 | export const meta = {
6 | title: "Why Cargoship?",
7 | };
8 |
9 | Developers need to adapt to these new techniques and learn how to implement them.
10 | This includes evaluating:
11 | - Which model is good,
12 | - which model do I need,
13 | - How was it trained,
14 | - What type of licence does it have,
15 | - And how to implement it.
16 |
17 | For a non-ML expert, these steps are hard work and often lead to frustration or even a return to normal coding without AI.
18 | Because AI is a fast-growing field, many platforms and players have created their space to find and use all kinds of models.
19 | These platforms do a great job, but none of them are suitable for absolute beginners and even for experts it's often time consuming to find the best model for their needs.
20 |
21 | export default ({ children }) => {children} ;
22 |
--------------------------------------------------------------------------------
/models/image-captioning/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import Depends, FastAPI, HTTPException
2 | from fastapi.middleware.cors import CORSMiddleware
3 |
4 | from app.api import Input, Output, get_api_key
5 | from app.predict import get_generator, predict
6 | from app.image import getImage
7 | import torch
8 |
9 | app = FastAPI(dependencies=[Depends(get_api_key)])
10 |
11 | app.add_middleware(
12 | CORSMiddleware,
13 | allow_origins=['*'],
14 | allow_credentials=True,
15 | allow_methods=["*"],
16 | allow_headers=["*"],
17 | )
18 | (tokenizer, feature_extractor, model) = get_generator() # load model
19 |
20 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21 | model.to(device)
22 |
23 | @app.post("/")
24 | async def make_prediction(input: Input) -> Output:
25 | try:
26 | image = getImage(input)
27 | except Exception as e:
28 | raise HTTPException(status_code=400, detail=str(e))
29 | if image.mode != "RGB":
30 | image = image.convert(mode="RGB")
31 | return predict(image, tokenizer, model, feature_extractor, device)
--------------------------------------------------------------------------------
/packages/lib/posthogServer.ts:
--------------------------------------------------------------------------------
1 | import { PostHog } from "posthog-node";
2 |
3 | const enabled =
4 | process.env.NODE_ENV === "production" &&
5 | process.env.NEXT_PUBLIC_POSTHOG_API_HOST &&
6 | process.env.NEXT_PUBLIC_POSTHOG_API_KEY;
7 |
8 | export const capturePosthogEvent = async (
9 | userId: string,
10 | eventName: string,
11 | teamId?: string,
12 | properties: any = {}
13 | ) => {
14 | if (
15 | !enabled ||
16 | typeof process.env.NEXT_PUBLIC_POSTHOG_API_HOST !== "string" ||
17 | typeof process.env.NEXT_PUBLIC_POSTHOG_API_KEY !== "string"
18 | ) {
19 | return;
20 | }
21 | try {
22 | const client = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_API_KEY, {
23 | host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
24 | });
25 | client.capture({
26 | event: eventName,
27 | distinctId: userId,
28 | groups: teamId ? { company: teamId } : {},
29 | properties,
30 | });
31 |
32 | await client.shutdownAsync();
33 | } catch (error) {
34 | console.error("error sending posthog event:", error);
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/apps/web/components/EmptyPageFiller.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@/components/ui/Button";
2 | import React from "react";
3 |
4 | interface Props {
5 | children: React.ReactNode;
6 | onClick?: () => void;
7 | alertText: string;
8 | hintText: string;
9 | buttonText?: string;
10 | borderStyles?: string;
11 | hasButton?: boolean;
12 | }
13 |
14 | const EmptyPageFiller: React.FC = ({
15 | children,
16 | onClick = () => {},
17 | alertText,
18 | hintText,
19 | buttonText,
20 | borderStyles,
21 | hasButton = false,
22 | }) => {
23 | return (
24 |
25 | {children}
26 |
{alertText}
27 |
{hintText}
28 | {hasButton && (
29 |
30 | {buttonText}
31 |
32 | )}
33 |
34 | );
35 | };
36 |
37 | export default EmptyPageFiller;
38 |
--------------------------------------------------------------------------------
/apps/web/pages/api/users/me/index.ts:
--------------------------------------------------------------------------------
1 | import { getSessionOrUser } from "@/lib/apiHelper";
2 | import { prisma } from "@cargoship/database";
3 | import type { NextApiRequest, NextApiResponse } from "next";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // Check Authentication
7 | const session = await getSessionOrUser(req, res);
8 | if (!session || !session.email) {
9 | return res.status(401).json({ message: "Not authenticated" });
10 | }
11 |
12 | // GET /api/users/me
13 | // Get the current user
14 | if (req.method === "GET") {
15 | const user = await prisma.user.findUnique({
16 | where: {
17 | email: session.email,
18 | },
19 | select: {
20 | id: true,
21 | createdAt: true,
22 | updatedAt: true,
23 | email: true,
24 | name: true,
25 | identityProvider: true,
26 | },
27 | });
28 | return res.json(user);
29 | }
30 |
31 | // Unknown HTTP Method
32 | else {
33 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/apps/web/pages/api/apis/[apiId]/index.ts:
--------------------------------------------------------------------------------
1 | import { getSessionOrUser } from "@/lib/apiHelper";
2 | import { prisma } from "@cargoship/database";
3 | import type { NextApiRequest, NextApiResponse } from "next";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // Check Authentication
7 | const user: any = await getSessionOrUser(req, res);
8 | if (!user) {
9 | return res.status(401).json({ message: "Not authenticated" });
10 | }
11 |
12 | const apiId = req.query.apiId as string;
13 |
14 | // GET
15 | if (req.method === "GET") {
16 | const api = await prisma.api.findUnique({
17 | where: {
18 | id: apiId,
19 | },
20 | select: {
21 | id: true,
22 | createdAt: true,
23 | name: true,
24 | description: true,
25 | cost: true,
26 | instructions: true,
27 | models: true,
28 | },
29 | });
30 |
31 | return res.json(api);
32 | }
33 |
34 | // Unknown HTTP Method
35 | else {
36 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/apps/demo/public/thirteen.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/ui/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/ui",
3 | "version": "0.0.0",
4 | "main": "./dist/index.js",
5 | "types": "./dist/index.d.ts",
6 | "exports": {
7 | ".": "./dist",
8 | "./styles.css": "./dist/styles.css"
9 | },
10 | "license": "MIT",
11 | "type": "module",
12 | "sideEffects": false,
13 | "scripts": {
14 | "build": "tsup src/index.tsx --format esm,cjs --dts --external react",
15 | "dev": "tsup src/index.tsx --format esm,cjs --dts --external react --watch",
16 | "clean": "rm -rf dist"
17 | },
18 | "devDependencies": {
19 | "@cargoship/tsconfig": "workspace:*",
20 | "@types/react": "^18.0.37",
21 | "@types/react-dom": "^18.0.11",
22 | "concurrently": "^8.0.1",
23 | "eslint": "^8.38.0",
24 | "eslint-config-cargoship": "workspace:*",
25 | "postcss": "^8.4.23",
26 | "react": "^18.2.0",
27 | "tsup": "^6.7.0",
28 | "typescript": "^5.0.4"
29 | },
30 | "dependencies": {
31 | "clsx": "^1.2.1",
32 | "next": "^13.3.0",
33 | "react-confetti": "^6.1.0",
34 | "react-dom": "^18.2.0",
35 | "react-use": "^17.4.0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/apps/demo/pages/api/sentiment.ts:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 | import type { NextApiRequest, NextApiResponse } from "next";
3 |
4 | export default async function handler(req: NextApiRequest, res: NextApiResponse) {
5 | if (!process.env.CARGOSHIP_API_KEY) {
6 | return res.status(500).json({ message: "No API key set" });
7 | }
8 |
9 | if (req.method === "POST") {
10 | const { text } = req.body;
11 | // fetch cargoship endpoint with API key from env
12 | const response = await fetch(`${process.env.CARGOSHIP_API_HOST}/api/sentiment`, {
13 | method: "POST",
14 | headers: {
15 | "Content-Type": "application/json",
16 | "X-Api-Key": process.env.CARGOSHIP_API_KEY || "",
17 | },
18 | body: JSON.stringify({ text }),
19 | });
20 | if (!response.ok) {
21 | return res.status(500).json({ message: "Something went wrong" });
22 | }
23 | const responseData = await response.json();
24 | return res.status(200).json(responseData);
25 | } else {
26 | return res.status(405).json({ message: "Method not allowed" });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/apps/demo/pages/api/detect-language.ts:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 | import type { NextApiRequest, NextApiResponse } from "next";
3 |
4 | export default async function handler(req: NextApiRequest, res: NextApiResponse) {
5 | if (!process.env.CARGOSHIP_API_KEY) {
6 | res.status(500).json({ message: "No API key set" });
7 | }
8 |
9 | if (req.method === "POST") {
10 | const { text } = req.body;
11 | // fetch cargoship endpoint with API key from env
12 | const response = await fetch(`${process.env.CARGOSHIP_API_HOST}/api/language-detection`, {
13 | method: "POST",
14 | headers: {
15 | "Content-Type": "application/json",
16 | "X-Api-Key": process.env.CARGOSHIP_API_KEY || "",
17 | },
18 | body: JSON.stringify({ text }),
19 | });
20 | if (!response.ok) {
21 | return res.status(500).json({ message: "Something went wrong" });
22 | }
23 | const responseData = await response.json();
24 | return res.status(200).json(responseData);
25 | } else {
26 | return res.status(405).json({ message: "Method not allowed" });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 stackOcean GmbH
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/sentiment-de/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/sentiment-en/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/image-captioning/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/image-classification/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/language-detection/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/summarization-en/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/language-detection/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | typing_extensions==4.4.0
46 | ujson==5.7.0
47 | urllib3==1.26.7
48 | uvicorn==0.20.0
49 | uvloop==0.17.0
50 | watchfiles==0.18.1
51 | websocket-client==1.3.2
52 | websockets==10.4
53 | yarl==1.7.2
54 |
--------------------------------------------------------------------------------
/models/text-generation-en-lg/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 stackOcean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/apps/web/lib/apiKeysClient.ts:
--------------------------------------------------------------------------------
1 | export const persistApiKey = async (apiKey) => {
2 | try {
3 | await fetch(`/api/users/me/api-keys/${apiKey.id}/`, {
4 | method: "POST",
5 | headers: { "Content-Type": "application/json" },
6 | body: JSON.stringify(apiKey),
7 | });
8 | } catch (error) {
9 | console.error(error);
10 | }
11 | };
12 |
13 | export const createApiKey = async (apiKey = {}) => {
14 | try {
15 | const res = await fetch(`/api/users/me/api-keys`, {
16 | method: "POST",
17 | headers: { "Content-Type": "application/json" },
18 | body: JSON.stringify(apiKey),
19 | });
20 | return await res.json();
21 | } catch (error) {
22 | console.error(error);
23 | throw Error(`createApiKey: unable to create api-key: ${error.message}`);
24 | }
25 | };
26 |
27 | export const deleteApiKey = async (apiKey) => {
28 | try {
29 | const res = await fetch(`/api/users/me/api-keys/${apiKey.id}`, {
30 | method: "DELETE",
31 | });
32 | return await res.json();
33 | } catch (error) {
34 | console.error(error);
35 | throw Error(`deleteApiKey: unable to delete api-key: ${error.message}`);
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/packages/database/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/database",
3 | "version": "1.0.0",
4 | "license": "MIT",
5 | "main": "./dist/index.js",
6 | "module": "./dist/index.mjs",
7 | "types": "./dist/index.d.ts",
8 | "files": [
9 | "dist/**"
10 | ],
11 | "scripts": {
12 | "build": "tsup",
13 | "clean": "rimraf .turbo node_modules dist",
14 | "db:migrate:deploy": "prisma migrate deploy",
15 | "db:migrate:dev": "prisma migrate dev",
16 | "db:push": "prisma db push",
17 | "db:seed": "tsx src/seed.ts",
18 | "dev": "tsup --watch",
19 | "format": "prisma format",
20 | "generate": "prisma generate",
21 | "lint": "eslint ./src --fix",
22 | "prebuild": "npm run generate",
23 | "predev": "npm run generate",
24 | "studio": "prisma studio"
25 | },
26 | "dependencies": {
27 | "@prisma/client": "^4.12.0"
28 | },
29 | "devDependencies": {
30 | "eslint-config-cargoship": "workspace:*",
31 | "eslint": "^8.37.0",
32 | "prisma": "^4.12.0",
33 | "rimraf": "^4.4.1",
34 | "@cargoship/tsconfig": "workspace:*",
35 | "tsup": "^6.7.0",
36 | "tsx": "^3.12.6",
37 | "typescript": "^5.0.3"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/MetaInformation.tsx:
--------------------------------------------------------------------------------
1 | import Head from "next/head";
2 |
3 | interface Props {
4 | title: string;
5 | description: string;
6 | }
7 |
8 | export default function MetaInformation({ title, description }: Props) {
9 | const pageTitle = `${title} | Open Source Forms & Surveys by Cargoship`;
10 | return (
11 |
12 | {pageTitle}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/UnderConstructionCTA.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@cargoship/ui";
2 | import BackgroundGradient from "../home/BackgroundGradient";
3 |
4 | export function UnderConstructionCTA() {
5 | return (
6 |
7 |
8 |
9 |
10 | We are working on hard on this
11 |
12 |
13 | Models will be launched soon
14 |
15 |
16 | We will be launching these models in the coming weeks. Stay tuned!
17 |
18 | Want to be the first to know? Join our Discord!
19 |
20 |
21 | Join Discord
22 |
23 |
24 |
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/models/sentiment-de/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | torch==1.13.1
46 | transformers==4.26.0
47 | typing_extensions==4.4.0
48 | ujson==5.7.0
49 | urllib3==1.26.7
50 | uvicorn==0.20.0
51 | uvloop==0.17.0
52 | watchfiles==0.18.1
53 | websocket-client==1.3.2
54 | websockets==10.4
55 | yarl==1.7.2
56 |
--------------------------------------------------------------------------------
/models/sentiment-en/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | torch==1.13.1
46 | transformers==4.26.0
47 | typing_extensions==4.4.0
48 | ujson==5.7.0
49 | urllib3==1.26.7
50 | uvicorn==0.20.0
51 | uvloop==0.17.0
52 | watchfiles==0.18.1
53 | websocket-client==1.3.2
54 | websockets==10.4
55 | yarl==1.7.2
56 |
--------------------------------------------------------------------------------
/models/summarization-en/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | torch==1.13.1
46 | transformers==4.26.0
47 | typing_extensions==4.4.0
48 | ujson==5.7.0
49 | urllib3==1.26.7
50 | uvicorn==0.20.0
51 | uvloop==0.17.0
52 | watchfiles==0.18.1
53 | websocket-client==1.3.2
54 | websockets==10.4
55 | yarl==1.7.2
56 |
--------------------------------------------------------------------------------
/models/text-generation-en-lg/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | torch==1.13.1
46 | transformers==4.26.0
47 | typing_extensions==4.4.0
48 | ujson==5.7.0
49 | urllib3==1.26.7
50 | uvicorn==0.20.0
51 | uvloop==0.17.0
52 | watchfiles==0.18.1
53 | websocket-client==1.3.2
54 | websockets==10.4
55 | yarl==1.7.2
56 |
--------------------------------------------------------------------------------
/models/text-generation-en-sm/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | finnhub-python==2.4.6
15 | frozenlist==1.3.0
16 | h11==0.14.0
17 | httpcore==0.16.3
18 | httptools==0.5.0
19 | httpx==0.23.3
20 | idna==3.3
21 | itsdangerous==2.1.2
22 | Jinja2==3.1.2
23 | MarkupSafe==2.1.1
24 | msgpack==1.0.3
25 | multidict==6.0.2
26 | newsapi==0.1.1
27 | newsapi-python==0.2.6
28 | numpy==1.22.4
29 | orjson==3.8.5
30 | package-name==0.1
31 | packaging==21.3
32 | pandas==1.4.2
33 | pybind11==2.10.3
34 | pydantic==1.10.4
35 | pyparsing==3.0.9
36 | python-dateutil==2.8.2
37 | python-dotenv==0.21.0
38 | python-multipart==0.0.5
39 | pytz==2022.1
40 | PyYAML==6.0
41 | requests==2.26.0
42 | rfc3986==1.5.0
43 | sniffio==1.3.0
44 | starlette==0.22.0
45 | torch==1.13.1
46 | transformers==4.26.0
47 | typing_extensions==4.4.0
48 | ujson==5.7.0
49 | urllib3==1.26.7
50 | uvicorn==0.20.0
51 | uvloop==0.17.0
52 | watchfiles==0.18.1
53 | websocket-client==1.3.2
54 | websockets==10.4
55 | yarl==1.7.2
56 |
--------------------------------------------------------------------------------
/packages/lib/fetcher.ts:
--------------------------------------------------------------------------------
1 | export const fetchRessource = async (url) => {
2 | const res = await fetch(url);
3 |
4 | // If the status code is not in the range 200-299,
5 | // we still try to parse and throw it.
6 | if (!res.ok) {
7 | const error: any = new Error("An error occurred while fetching the data.");
8 | // Attach extra info to the error object.
9 | error.info = await res.json();
10 | error.status = res.status;
11 | throw error;
12 | }
13 |
14 | return res.json();
15 | };
16 |
17 | export const fetcher = async (url) => {
18 | const res = await fetch(url);
19 |
20 | // If the status code is not in the range 200-299,
21 | // we still try to parse and throw it.
22 | if (!res.ok) {
23 | const error: any = new Error("An error occurred while fetching the data.");
24 | // Attach extra info to the error object.
25 | error.info = await res.json();
26 | error.status = res.status;
27 | throw error;
28 | }
29 |
30 | return res.json();
31 | };
32 |
33 | export const updateRessource = async (url, { arg }) => {
34 | return fetch(url, {
35 | method: "PUT",
36 | headers: { "Content-Type": "application/json" },
37 | body: JSON.stringify(arg),
38 | });
39 | };
40 |
--------------------------------------------------------------------------------
/apps/web/pages/api/users/forgot-password.tsx:
--------------------------------------------------------------------------------
1 | import type { NextApiRequest, NextApiResponse } from "next";
2 | import { prisma } from "@cargoship/database";
3 | import { sendForgotPasswordEmail } from "@/lib/email";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // POST /api/public/users/forgot-password
7 | // Sends a reset password email to the user
8 | // Required fields in body: email
9 | if (req.method === "POST") {
10 | const { email } = req.body;
11 |
12 | try {
13 | const foundUser = await prisma.user.findUnique({
14 | where: {
15 | email: email.toLowerCase(),
16 | },
17 | });
18 |
19 | if (!foundUser) {
20 | return res.status(409).json({
21 | error: "no user with this email found",
22 | });
23 | }
24 |
25 | await sendForgotPasswordEmail(foundUser);
26 | res.json({});
27 | } catch (e) {
28 | return res.status(500).json({
29 | error: e.message,
30 | errorCode: e.code,
31 | });
32 | }
33 | }
34 |
35 | // Unknown HTTP Method
36 | else {
37 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/layout/LayoutMdx.tsx:
--------------------------------------------------------------------------------
1 | import Footer from "../shared/Footer";
2 | import MetaInformation from "../shared/MetaInformation";
3 | import { Prose } from "../shared/Prose";
4 | import Navbar from "./Navbar";
5 |
6 | interface Props {
7 | meta: {
8 | title: string;
9 | description: string;
10 | };
11 | children: JSX.Element;
12 | }
13 |
14 | export default function LayoutMdx({ meta, children }: Props) {
15 | return (
16 |
17 |
18 |
19 |
20 |
21 | {meta.title && (
22 |
23 | {meta.title && (
24 | {meta.title}
25 | )}
26 |
27 | )}
28 | {children}
29 |
30 |
31 |
32 |
33 | );
34 | }
35 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/public/favicon/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 | Created by potrace 1.14, written by Peter Selinger 2001-2017
9 |
10 |
12 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/icons/InstallationIcon.jsx:
--------------------------------------------------------------------------------
1 | import { DarkMode, Gradient, LightMode } from "@/components/shared/Icon";
2 |
3 | export function InstallationIcon({ id, color }) {
4 | return (
5 | <>
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
22 |
30 |
31 | >
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/TryItCTA.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@cargoship/ui";
2 | import BackgroundGradient from "../home/BackgroundGradient";
3 |
4 | export function TryItCTA() {
5 | return (
6 |
7 |
8 |
9 |
10 | What are you waiting for?
11 |
12 |
13 | Try it right now!
14 |
15 |
16 | Dive right into our model collections and explore what you can do with Cargoship.
17 |
18 | Questions? Join our Discord, we’re happy to help!
19 |
20 |
21 | Check out the models
22 |
23 |
24 | Join Discord
25 |
26 |
27 |
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/apps/web/app/auth/verification-requested/page.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { RequestVerificationEmail } from "@/components/auth/RequestVerificationEmail";
4 | import { useSearchParams } from "next/navigation";
5 |
6 | export default function VerficationPage() {
7 | const searchParams = useSearchParams();
8 | return (
9 |
10 | {searchParams && searchParams?.get("email") ? (
11 | <>
12 |
13 | Please confirm your email address
14 |
15 |
16 | We sent an email to {searchParams.get("email")} .
17 | Please click the link in the email to activate your account.
18 |
19 |
20 |
21 | You didn't receive an email or your link expired?
22 |
23 |
24 |
25 |
26 | >
27 | ) : (
28 |
No E-Mail Address provided
29 | )}
30 |
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/apps/demo/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/models/image-captioning/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | filelock==3.9.0
15 | finnhub-python==2.4.6
16 | frozenlist==1.3.0
17 | h11==0.14.0
18 | httpcore==0.16.3
19 | httptools==0.5.0
20 | httpx==0.23.3
21 | huggingface-hub==0.12.0
22 | idna==3.3
23 | itsdangerous==2.1.2
24 | Jinja2==3.1.2
25 | MarkupSafe==2.1.1
26 | msgpack==1.0.3
27 | multidict==6.0.2
28 | newsapi==0.1.1
29 | newsapi-python==0.2.6
30 | numpy==1.22.4
31 | orjson==3.8.5
32 | package-name==0.1
33 | packaging==21.3
34 | pandas==1.4.2
35 | Pillow==9.4.0
36 | pybind11==2.10.3
37 | pydantic==1.10.4
38 | pyparsing==3.0.9
39 | python-dateutil==2.8.2
40 | python-dotenv==0.21.0
41 | python-multipart==0.0.5
42 | pytz==2022.1
43 | PyYAML==6.0
44 | regex==2022.10.31
45 | requests==2.26.0
46 | rfc3986==1.5.0
47 | six==1.16.0
48 | sniffio==1.3.0
49 | starlette==0.22.0
50 | tokenizers==0.13.2
51 | torch==1.13.1
52 | tqdm==4.64.1
53 | transformers==4.26.0
54 | typing_extensions==4.4.0
55 | ujson==5.7.0
56 | urllib3==1.26.7
57 | uvicorn==0.20.0
58 | uvloop==0.17.0
59 | watchfiles==0.18.1
60 | websocket-client==1.3.2
61 | websockets==10.4
62 | yarl==1.7.2
63 |
--------------------------------------------------------------------------------
/models/whisper-tiny-en/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | filelock==3.9.0
15 | finnhub-python==2.4.6
16 | frozenlist==1.3.0
17 | h11==0.14.0
18 | httpcore==0.16.3
19 | httptools==0.5.0
20 | httpx==0.23.3
21 | huggingface-hub==0.12.0
22 | idna==3.3
23 | itsdangerous==2.1.2
24 | Jinja2==3.1.2
25 | MarkupSafe==2.1.1
26 | msgpack==1.0.3
27 | multidict==6.0.2
28 | newsapi==0.1.1
29 | newsapi-python==0.2.6
30 | numpy==1.22.4
31 | orjson==3.8.5
32 | package-name==0.1
33 | packaging==21.3
34 | pandas==1.4.2
35 | Pillow==9.4.0
36 | pybind11==2.10.3
37 | pydantic==1.10.4
38 | pyparsing==3.0.9
39 | python-dateutil==2.8.2
40 | python-dotenv==0.21.0
41 | python-multipart==0.0.5
42 | pytz==2022.1
43 | PyYAML==6.0
44 | regex==2022.10.31
45 | requests==2.26.0
46 | rfc3986==1.5.0
47 | six==1.16.0
48 | sniffio==1.3.0
49 | starlette==0.22.0
50 | tokenizers==0.13.2
51 | torch==1.13.1
52 | tqdm==4.64.1
53 | transformers==4.26.0
54 | typing_extensions==4.4.0
55 | ujson==5.7.0
56 | urllib3==1.26.7
57 | uvicorn==0.20.0
58 | uvloop==0.17.0
59 | watchfiles==0.18.1
60 | websocket-client==1.3.2
61 | websockets==10.4
62 | yarl==1.7.2
63 |
--------------------------------------------------------------------------------
/apps/web/pages/api/users/verification-email.tsx:
--------------------------------------------------------------------------------
1 | import type { NextApiRequest, NextApiResponse } from "next";
2 | import { prisma } from "@cargoship/database";
3 | import { sendVerificationEmail } from "@/lib/email";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // POST /api/public/users/verification-email
7 | // Sends a new verification email to a user with a specific email address
8 | // Required fields in body: email
9 | if (req.method === "POST") {
10 | const { email } = req.body;
11 | // create user in database
12 | try {
13 | const user = await prisma.user.findUnique({
14 | where: { email },
15 | });
16 | if (!user) {
17 | return res.status(404).json({
18 | error: "No user with this email address found",
19 | });
20 | }
21 | if (user.emailVerified) {
22 | return res.status(400).json({
23 | error: "Email address has already been verified",
24 | });
25 | }
26 | await sendVerificationEmail(user);
27 | res.json(user);
28 | } catch (e) {
29 | return res.status(500).json({
30 | error: e.message,
31 | });
32 | }
33 | }
34 |
35 | // Unknown HTTP Method
36 | else {
37 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/models/image-classification/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | filelock==3.9.0
15 | finnhub-python==2.4.6
16 | frozenlist==1.3.0
17 | h11==0.14.0
18 | httpcore==0.16.3
19 | httptools==0.5.0
20 | httpx==0.23.3
21 | huggingface-hub==0.12.0
22 | idna==3.3
23 | itsdangerous==2.1.2
24 | Jinja2==3.1.2
25 | MarkupSafe==2.1.1
26 | msgpack==1.0.3
27 | multidict==6.0.2
28 | newsapi==0.1.1
29 | newsapi-python==0.2.6
30 | numpy==1.22.4
31 | orjson==3.8.5
32 | package-name==0.1
33 | packaging==21.3
34 | pandas==1.4.2
35 | Pillow==9.4.0
36 | pybind11==2.10.3
37 | pydantic==1.10.4
38 | pyparsing==3.0.9
39 | python-dateutil==2.8.2
40 | python-dotenv==0.21.0
41 | python-multipart==0.0.5
42 | pytz==2022.1
43 | PyYAML==6.0
44 | regex==2022.10.31
45 | requests==2.26.0
46 | rfc3986==1.5.0
47 | six==1.16.0
48 | sniffio==1.3.0
49 | starlette==0.22.0
50 | tokenizers==0.13.2
51 | torch==1.13.1
52 | tqdm==4.64.1
53 | transformers==4.26.0
54 | typing_extensions==4.4.0
55 | ujson==5.7.0
56 | urllib3==1.26.7
57 | uvicorn==0.20.0
58 | uvloop==0.17.0
59 | watchfiles==0.18.1
60 | websocket-client==1.3.2
61 | websockets==10.4
62 | yarl==1.7.2
63 |
--------------------------------------------------------------------------------
/models/ocr-base-handwritten/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.8.1
2 | aiosignal==1.2.0
3 | anyio==3.6.2
4 | async-timeout==4.0.2
5 | attrs==21.4.0
6 | certifi==2021.10.8
7 | charset-normalizer==2.0.9
8 | click==8.1.3
9 | deprecation==2.1.0
10 | dnspython==2.2.1
11 | email-validator==1.3.0
12 | fastapi==0.89.1
13 | fasttext==0.9.2
14 | filelock==3.9.0
15 | finnhub-python==2.4.6
16 | frozenlist==1.3.0
17 | h11==0.14.0
18 | httpcore==0.16.3
19 | httptools==0.5.0
20 | httpx==0.23.3
21 | huggingface-hub==0.12.0
22 | idna==3.3
23 | itsdangerous==2.1.2
24 | Jinja2==3.1.2
25 | MarkupSafe==2.1.1
26 | msgpack==1.0.3
27 | multidict==6.0.2
28 | newsapi==0.1.1
29 | newsapi-python==0.2.6
30 | numpy==1.22.4
31 | orjson==3.8.5
32 | package-name==0.1
33 | packaging==21.3
34 | pandas==1.4.2
35 | Pillow==9.4.0
36 | pybind11==2.10.3
37 | pydantic==1.10.4
38 | pyparsing==3.0.9
39 | python-dateutil==2.8.2
40 | python-dotenv==0.21.0
41 | python-multipart==0.0.5
42 | pytz==2022.1
43 | PyYAML==6.0
44 | regex==2022.10.31
45 | requests==2.26.0
46 | rfc3986==1.5.0
47 | six==1.16.0
48 | sniffio==1.3.0
49 | starlette==0.22.0
50 | tokenizers==0.13.2
51 | torch==1.13.1
52 | tqdm==4.64.1
53 | transformers==4.26.0
54 | typing_extensions==4.4.0
55 | ujson==5.7.0
56 | urllib3==1.26.7
57 | uvicorn==0.20.0
58 | uvloop==0.17.0
59 | watchfiles==0.18.1
60 | websocket-client==1.3.2
61 | websockets==10.4
62 | yarl==1.7.2
63 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/Prose.jsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 |
3 | export function Prose({ as: Component = "div", className, ...props }) {
4 | return (
5 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/apps/web/pages/api/teams/[teamId]/index.ts:
--------------------------------------------------------------------------------
1 | import { getSessionOrUser } from "@/lib/apiHelper";
2 | import { prisma } from "@cargoship/database";
3 | import type { NextApiRequest, NextApiResponse } from "next";
4 |
5 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
6 | // Check Authentication
7 | const user: any = await getSessionOrUser(req, res);
8 | if (!user) {
9 | return res.status(401).json({ message: "Not authenticated" });
10 | }
11 |
12 | const teamId = req.query.teamId as string;
13 |
14 | // GET /api/teams[teamId]
15 | // Get a specific team
16 | if (req.method === "GET") {
17 | // check if membership exists
18 | const membership = await prisma.membership.findUnique({
19 | where: {
20 | userId_teamId: {
21 | userId: user.id,
22 | teamId,
23 | },
24 | },
25 | });
26 | if (membership === null) {
27 | return res
28 | .status(403)
29 | .json({ message: "You don't have access to this team or this team doesn't exist" });
30 | }
31 | const team = await prisma.team.findUnique({
32 | where: {
33 | id: teamId,
34 | },
35 | });
36 | return res.json(team);
37 | }
38 |
39 | // Unknown HTTP Method
40 | else {
41 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/apps/web/app/teams/[teamId]/apis/page.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@/components/ui/Button";
2 | import { ContentWrapper } from "@/components/ContentWrapper";
3 | import { getApis } from "@/lib/apis";
4 | import Avatar from "boring-avatars";
5 |
6 | export default async function ApiOverviewPage({ params }) {
7 | const apis = await getApis();
8 | return (
9 |
10 |
11 | {apis.map((api) => (
12 |
13 |
16 | {/*
*/}
17 |
18 | {api.name}
19 |
20 |
{api.description}
21 |
22 | View
23 |
24 |
25 | ))}
26 |
27 |
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/apps/web/lib/docker.ts:
--------------------------------------------------------------------------------
1 | import { execa } from "execa";
2 | import * as fs from "fs/promises";
3 |
4 | export const setupProject = async (projectId: string) => {
5 | await execa("mkdir", ["-p", `../../docker/projects/${projectId}`]);
6 | let dockerCompose = await fs.readFile("./templates/docker-compose.yml", { encoding: "utf8" });
7 | dockerCompose = dockerCompose.replaceAll("{{project_id}}", projectId);
8 | await fs.writeFile(`../../docker/projects/${projectId}/docker-compose.yml`, dockerCompose);
9 | };
10 |
11 | export const deleteProject = async (projectId: string) => {
12 | await execa("rm", ["-rf", `../../docker/projects/${projectId}`]);
13 | };
14 |
15 | export const fetchLogs = async (projectId: string) => {
16 | const { stdout } = await execa("docker", ["compose", "logs", "--tail=200"], {
17 | cwd: `../../docker/projects/${projectId}`,
18 | });
19 | return stdout;
20 | };
21 |
22 | export const overwriteRFile = async (projectId: string, rFileContent: string) => {
23 | await fs.writeFile(`../../docker/projects/${projectId}/app.R`, rFileContent);
24 | };
25 |
26 | export const startServer = async (projectId: string) => {
27 | await execa("docker", ["compose", "up", "-d"], {
28 | cwd: `../../docker/projects/${projectId}`,
29 | });
30 | };
31 |
32 | export const stopServer = async (projectId: string) => {
33 | await execa("docker", ["compose", "down"], {
34 | cwd: `../../docker/projects/${projectId}`,
35 | });
36 | };
37 |
--------------------------------------------------------------------------------
/apps/web/pages/api/users/reset-password.tsx:
--------------------------------------------------------------------------------
1 | import type { NextApiRequest, NextApiResponse } from "next";
2 | import { prisma } from "@cargoship/database";
3 | import { sendPasswordResetNotifyEmail } from "@/lib/email";
4 | import { verifyToken } from "@/lib/jwt";
5 |
6 | export default async function handle(req: NextApiRequest, res: NextApiResponse) {
7 | // POST /api/public/users/reset-password
8 | // Resets a users password
9 | // Required fields in body: token, hashedPassword
10 | if (req.method === "POST") {
11 | const { token, hashedPassword } = req.body;
12 |
13 | try {
14 | const { id } = await verifyToken(token);
15 | const user = await prisma.user.findUnique({
16 | where: {
17 | id: id,
18 | },
19 | });
20 | if (!user) {
21 | return res.status(409).json({
22 | error: "Invalid token provided or no longer valid",
23 | });
24 | }
25 | await prisma.user.update({
26 | where: { id: user.id },
27 | data: { password: hashedPassword },
28 | });
29 | await sendPasswordResetNotifyEmail(user);
30 | res.json({});
31 | } catch (e) {
32 | return res.status(500).json({
33 | error: "Invalid token provided or no longer valid",
34 | });
35 | }
36 | }
37 |
38 | // Unknown HTTP Method
39 | else {
40 | throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/cloud/index.tsx:
--------------------------------------------------------------------------------
1 | import Hero from "@/components/cloud/Hero";
2 | import Cloud from "@/components/cloud/Features";
3 | import CTA from "@/components/cloud/CTA";
4 | import Pricing from "@/components/cloud/Pricing";
5 | import Navbar from "@/components/layout/Navbar";
6 | import Footer from "@/components/shared/Footer";
7 | import MetaInformation from "@/components/shared/MetaInformation";
8 | import { UniversalCTA } from "@/components/shared/UniversalCTA";
9 |
10 | export default function CloudLanding() {
11 | return (
12 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/docs/introduction/your-benefits/index.mdx:
--------------------------------------------------------------------------------
1 | import { Layout } from "@/components/docs/Layout";
2 | import Image from "next/image";
3 | import { Callout } from "@/components/shared/Callout";
4 |
5 | export const meta = {
6 | title: "Your benefits",
7 | };
8 |
9 | Incorporating machine learning and intelligent behavior into your app can be a daunting task. Problems include:
10 |
11 | - Which models to use, which are production-ready?
12 | - Mastering ML tooling and understanding machine learning tech stacks
13 | - Packaging the models into a production-ready API
14 |
15 | We have been through these processes and challenges many times and want to share our experiences with you. We want to help you get started with machine learning without the hassle.
16 |
17 | Here is what you get when you use the CargoShip machine learning models:
18 |
19 | - Curated and production-ready models for your use case
20 | - Models packaged in a production-ready API that you can easily deploy on your servers via Docker
21 | - Embed your models into your (webbased) apps without worrying about the backend and no matter your tech stack
22 | - A hosted offering to get you started even faster and scale with your needs (coming soon)
23 |
24 | You can use the models for free, with no strings attached. All we ask is that you share your use case with us so we can improve the models and make them even better.
25 |
26 | export default ({ children }) => {children} ;
27 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/home/BackgroundGradient.tsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 |
3 | export default function BackgroundGradient({ rotate = false }) {
4 | return (
5 |
6 |
14 |
19 |
20 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | );
34 | }
35 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import Features from "@/components/home/Features";
2 | import Hero from "@/components/home/Hero";
3 | import ModelCollection from "@/components/home/ModelCollection";
4 | import Navbar from "@/components/layout/Navbar";
5 | import Footer from "@/components/shared/Footer";
6 | import GithubInfo from "@/components/shared/GithubInfo";
7 | import MetaInformation from "@/components/shared/MetaInformation";
8 | import { UniversalCTA } from "@/components/shared/UniversalCTA";
9 |
10 | export default function HomePage() {
11 | return (
12 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
32 |
33 |
34 |
35 |
36 |
37 | );
38 | }
39 |
--------------------------------------------------------------------------------
/apps/web/next.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('next').NextConfig}
3 | */
4 | require("dotenv").config({ path: "../../.env" });
5 |
6 | /* if (!process.env.NEXTAUTH_SECRET) throw new Error("Please set NEXTAUTH_SECRET"); */
7 |
8 | module.exports = {
9 | experimental: {
10 | appDir: true,
11 | },
12 | output: "standalone",
13 | transpilePackages: ["@cargoship/database", "@cargoship/ee", "@cargoship/ui", "@cargoship/lib"],
14 | images: {
15 | remotePatterns: [
16 | {
17 | protocol: "https",
18 | hostname: "avatars.githubusercontent.com",
19 | },
20 | ],
21 | },
22 | async headers() {
23 | return [
24 | {
25 | // matching all API routes
26 | source: "/api/:path*",
27 | headers: [
28 | { key: "Access-Control-Allow-Credentials", value: "true" },
29 | { key: "Access-Control-Allow-Origin", value: "*" },
30 | { key: "Access-Control-Allow-Methods", value: "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
31 | {
32 | key: "Access-Control-Allow-Headers",
33 | value:
34 | "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key",
35 | },
36 | ],
37 | },
38 | ];
39 | },
40 | webpack: (config) => {
41 | config.externals = [...(config.externals || []), "@prisma/client"];
42 | // Important: return the modified config
43 | return config;
44 | },
45 | };
46 |
--------------------------------------------------------------------------------
/models/language-detection/app/language_detection.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 |
4 | import fasttext
5 | from fasttext import tokenize
6 |
7 | from app.api import Input, Output
8 |
9 |
10 | white_space_pattern = re.compile(r"\s")
11 |
12 | fasttext_language_model = fasttext.load_model(os.path.join("model", "lid.176.ftz"))
13 |
14 | def preprocess_text_for_language_detection(text: str):
15 | """
16 | Cleans the text as per fasttext requirements.
17 | The requirements can be found here: https://pypi.org/project/fasttext/
18 |
19 | :text: str: text to clean
20 | :returns: str: cleaned text
21 | """
22 | # fastText assumes UTF-8 encoded text
23 | text = str(text)
24 |
25 | # fastText is not aware of UTF-8 whitespace
26 | # Replace all white space with space
27 | text = white_space_pattern.sub(text, " ")
28 |
29 | # Tokenize text, per fastext function and rejoin
30 | tokens = tokenize(text)
31 | text = " ".join(tokens)
32 |
33 | # Remove white space char as it affects the model accuracy
34 | text = text.replace("", "")
35 |
36 | return text.lower()
37 |
38 |
39 | def handle_detect_language_request(input: Input) -> Output:
40 | """
41 | Detects the language of the input text.
42 | :input: Input: input text
43 | :returns: Output: output language
44 | """
45 | text = preprocess_text_for_language_detection(input.text)
46 | language = fasttext_language_model.predict(text, k=1)[0][0].replace("__label__", "")
47 | return Output(language=language)
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/cloud/CTA.tsx:
--------------------------------------------------------------------------------
1 | export default function Example() {
2 | return (
3 |
4 |
5 |
6 | Future-Proof Your Software.
7 |
8 | Trust in Quality.
9 |
10 |
11 | Embrace the power of cloud computing and seamlessly integrate AI into your software with our cloud-powered model hosting. Experience the convenience, scalability, and reliability that our platform offers. Join us on this exciting journey and unlock the endless possibilities of machine learning for your business or development projects.
12 |
13 |
24 |
25 |
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/pages/collections/data-processing/index.tsx:
--------------------------------------------------------------------------------
1 | import Navbar from "@/components/layout/Navbar";
2 | import Footer from "@/components/shared/Footer";
3 | import MetaInformation from "@/components/shared/MetaInformation";
4 | import { UnderConstructionCTA } from "@/components/shared/UnderConstructionCTA";
5 |
6 | export default function CollectionsOverviewPage() {
7 | return (
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Collection
20 |
21 |
22 | General Data Processing
23 |
24 |
25 | Classify data, find patterns, predict values and more
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | );
37 | }
38 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/components/shared/Callout.tsx:
--------------------------------------------------------------------------------
1 | import clsx from "clsx";
2 |
3 | import { Icon } from "@/components/shared/Icon";
4 |
5 | const styles = {
6 | note: {
7 | container: "bg-slate-800/60 ring-1 ring-slate-300/10",
8 | title: "text-slate-400",
9 | body: "text-slate-300 [--tw-prose-background:theme(colors.slate.50)] prose-a:text-slate-300 prose-code:text-slate-300 [--tw-prose-underline:theme(colors.slate.400)]",
10 | },
11 | warning: {
12 | container: "bg-slate-800/60 ring-1 ring-slate-300/10",
13 | title: "text-amber-500",
14 | body: "text-slate-300 [--tw-prose-background:theme(colors.amber.50)] prose-a:text-amber-300 [--tw-prose-underline:theme(colors.slate.400)] prose-code:text-slate-300",
15 | },
16 | };
17 |
18 | const icons = {
19 | note: (props: any) => ,
20 | warning: (props: any) => ,
21 | };
22 |
23 | interface CalloutProps {
24 | type: "note" | "warning";
25 | title: string;
26 | children: React.ReactNode;
27 | }
28 |
29 | export function Callout({ type = "note", title, children }: CalloutProps) {
30 | let IconComponent = icons[type];
31 |
32 | return (
33 |
34 |
35 |
36 |
{title}
37 |
{children}
38 |
39 |
40 | );
41 | }
42 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@cargoship/cargoship-sh",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev -p 3001",
7 | "build": "next build",
8 | "postbuild": "next-sitemap",
9 | "start": "next start",
10 | "lint": "next lint"
11 | },
12 | "dependencies": {
13 | "@cargoship/ui": "workspace:*",
14 | "@docsearch/react": "^3.3.3",
15 | "@headlessui/react": "^1.7.14",
16 | "@heroicons/react": "^2.0.17",
17 | "@mapbox/rehype-prism": "^0.8.0",
18 | "@mdx-js/loader": "^2.3.0",
19 | "@mdx-js/react": "^2.3.0",
20 | "@next/mdx": "^13.3.0",
21 | "add": "^2.0.6",
22 | "clsx": "^1.2.1",
23 | "lottie-web": "^5.11.0",
24 | "next": "13.3.0",
25 | "next-plausible": "^3.7.2",
26 | "next-sitemap": "^4.0.7",
27 | "prism-react-renderer": "^1.3.5",
28 | "react": "18.2.0",
29 | "react-dom": "18.2.0",
30 | "react-hook-form": "^7.43.9",
31 | "react-icons": "^4.8.0",
32 | "react-images-uploading": "^3.1.7",
33 | "react-responsive-embed": "^2.1.0",
34 | "remark-gfm": "^3.0.1",
35 | "sharp": "^0.32.0",
36 | "uuid": "^9.0.0"
37 | },
38 | "devDependencies": {
39 | "@tailwindcss/forms": "^0.5.3",
40 | "@tailwindcss/typography": "^0.5.9",
41 | "@types/node": "18.15.13",
42 | "@types/react": "18.0.37",
43 | "@types/react-dom": "18.0.11",
44 | "autoprefixer": "^10.4.14",
45 | "eslint": "8.38.0",
46 | "eslint-config-cargoship": "workspace:*",
47 | "postcss": "^8.4.23",
48 | "tailwindcss": "^3.3.1",
49 | "typescript": "5.0.4"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/apps/cargoship-sh/next.config.mjs:
--------------------------------------------------------------------------------
1 | import nextMDX from "@next/mdx";
2 | import { withPlausibleProxy } from "next-plausible";
3 | import remarkGfm from "remark-gfm";
4 | import rehypePrism from "@mapbox/rehype-prism";
5 |
6 | const nextConfig = {
7 | reactStrictMode: true,
8 | swcMinify: true,
9 | transpilePackages: ["@cargoship/ui"],
10 | pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
11 | async redirects() {
12 | return [
13 | {
14 | source: "/github",
15 | destination: "https://github.com/cargoshipsh/cargoship",
16 | permanent: false,
17 | },
18 | {
19 | source: "/privacy",
20 | destination: "/privacy-policy",
21 | permanent: false,
22 | },
23 | {
24 | source: "/discord",
25 | destination: "https://discord.gg/FJcdC8K6tf",
26 | permanent: false,
27 | },
28 | {
29 | source: "/github",
30 | destination: "https://github.com/cargoshipsh/cargoship",
31 | permanent: false,
32 | },
33 | ];
34 | },
35 | };
36 |
37 | const withMDX = nextMDX({
38 | extension: /\.mdx?$/,
39 | options: {
40 | // If you use remark-gfm, you'll need to use next.config.mjs
41 | // as the package is ESM only
42 | // https://github.com/remarkjs/remark-gfm#install
43 | remarkPlugins: [remarkGfm],
44 | rehypePlugins: [rehypePrism],
45 | // If you use `MDXProvider`, uncomment the following line.
46 | // providerImportSource: "@mdx-js/react",
47 | },
48 | });
49 |
50 | export default withPlausibleProxy({ customDomain: "https://plausible.stackocean.com" })(withMDX(nextConfig));
51 |
--------------------------------------------------------------------------------
/apps/web/lib/apiHelper.ts:
--------------------------------------------------------------------------------
1 | import { authOptions } from "@/app/api/auth/[...nextauth]/authOptions";
2 | import { prisma } from "@cargoship/database";
3 | import { createHash } from "crypto";
4 | import { NextApiRequest, NextApiResponse } from "next";
5 | import { User, getServerSession } from "next-auth";
6 |
7 | export const hashApiKey = (key: string): string => createHash("sha256").update(key).digest("hex");
8 |
9 | export const hasOwnership = async (model, session, id) => {
10 | try {
11 | const entity = await prisma[model].findUnique({
12 | where: { id: id },
13 | include: {
14 | user: {
15 | select: { email: true },
16 | },
17 | },
18 | });
19 | if (entity.user.email === session.user.email) {
20 | return true;
21 | } else {
22 | return false;
23 | }
24 | } catch (e) {
25 | console.error(`can't verify ownership: ${e}`);
26 | return false;
27 | }
28 | };
29 |
30 | export const getSessionOrUser = async (
31 | req: NextApiRequest,
32 | res: NextApiResponse
33 | ): Promise => {
34 | // check for session (browser usage)
35 | let session = await getServerSession(req, res, authOptions);
36 | if (session && "user" in session) return session.user;
37 | // check for api key
38 | if (req.headers["x-api-key"]) {
39 | const apiKey = await prisma.apiKey.findUnique({
40 | where: {
41 | hashedKey: hashApiKey(req.headers["x-api-key"].toString()),
42 | },
43 | include: {
44 | user: true,
45 | },
46 | });
47 | if (apiKey && apiKey.user) {
48 | return apiKey.user;
49 | }
50 | }
51 | };
52 |
--------------------------------------------------------------------------------
/apps/web/app/PosthogClient.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import { usePathname, useSearchParams } from "next/navigation";
4 | import posthog from "posthog-js";
5 | import { PostHogProvider } from "posthog-js/react";
6 | import { useEffect } from "react";
7 |
8 | const posthogEnabled = process.env.NEXT_PUBLIC_POSTHOG_API_KEY && process.env.NEXT_PUBLIC_POSTHOG_API_HOST;
9 |
10 | // Check that PostHog is client-side (used to handle Next.js SSR)
11 | if (
12 | typeof window !== "undefined" &&
13 | posthogEnabled &&
14 | typeof process.env.NEXT_PUBLIC_POSTHOG_API_KEY === "string" &&
15 | typeof process.env.NEXT_PUBLIC_POSTHOG_API_HOST === "string"
16 | ) {
17 | posthog.init(process.env.NEXT_PUBLIC_POSTHOG_API_KEY, {
18 | api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
19 | // Disable in development
20 | loaded: (posthog) => {
21 | if (process.env.NODE_ENV === "development") posthog.opt_out_capturing();
22 | },
23 | });
24 | }
25 |
26 | export function PosthogClientWrapper({ children }: { children: React.ReactNode }) {
27 | const pathname = usePathname();
28 | const searchParams = useSearchParams();
29 |
30 | useEffect(() => {
31 | if (posthogEnabled && pathname) {
32 | let url = window.origin + pathname;
33 | if (searchParams?.toString()) {
34 | url = url + `?${searchParams.toString()}`;
35 | }
36 | posthog.capture("$pageview", {
37 | $current_url: url,
38 | });
39 | }
40 | }, [pathname, searchParams]);
41 |
42 | if (posthogEnabled) {
43 | return {children} ;
44 | } else {
45 | return <>{children}>;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turborepo.org/schema.json",
3 | "pipeline": {
4 | "build": {
5 | "dependsOn": ["^build"],
6 | "outputs": ["dist/**", ".next/**"],
7 | "env": [
8 | "CARGOSHIP_API_KEY",
9 | "CARGOSHIP_API_HOST",
10 | "PROXY_API_KEY",
11 | "GITHUB_ID",
12 | "GITHUB_SECRET",
13 | "MAIL_FROM",
14 | "NEXT_PUBLIC_DEMO_API_KEY",
15 | "NEXT_PUBLIC_WEBAPP_URL",
16 | "NEXT_PUBLIC_DOCSEARCH_APP_ID",
17 | "NEXT_PUBLIC_DOCSEARCH_API_KEY",
18 | "NEXT_PUBLIC_DOCSEARCH_INDEX_NAME",
19 | "NEXT_PUBLIC_GITHUB_AUTH_ENABLED",
20 | "NEXT_PUBLIC_EMAIL_VERIFICATION_DISABLED",
21 | "NEXT_PUBLIC_PASSWORD_RESET_DISABLED",
22 | "NEXT_PUBLIC_POSTHOG_API_KEY",
23 | "NEXT_PUBLIC_POSTHOG_API_HOST",
24 | "NEXT_PUBLIC_PRIVACY_URL",
25 | "NEXT_PUBLIC_SIGNUP_DISABLED",
26 | "NEXT_PUBLIC_TERMS_URL",
27 | "NEXT_PUBLIC_VERCEL_URL",
28 | "NEXTAUTH_SECRET",
29 | "NEXTAUTH_URL",
30 | "SMTP_HOST",
31 | "SMTP_PASSWORD",
32 | "SMTP_PORT",
33 | "SMTP_SECURE_ENABLED",
34 | "SMTP_USER",
35 | "VERCEL_URL"
36 | ]
37 | },
38 | "db:migrate:deploy": {
39 | "outputs": []
40 | },
41 | "db:push": {
42 | "outputs": []
43 | },
44 | "db:seed": {
45 | "outputs": []
46 | },
47 | "dev": {
48 | "cache": false
49 | },
50 | "start": {
51 | "outputs": []
52 | },
53 | "generate": {
54 | "dependsOn": ["^generate"]
55 | },
56 | "lint": {
57 | "outputs": []
58 | }
59 | },
60 | "globalEnv": ["NODE_ENV"]
61 | }
62 |
--------------------------------------------------------------------------------