Skip to content

Latest commit

 

History

History

README.md

Next.js ModelFusion Demo

Next.js app, image generation, transcription, object streaming, OpenAI, Stability AI, Ollama

Examples of using ModelFusion with Next.js 14 (App Router):

  • image generation
  • voice recording & transcription
  • object streaming

Usage

  1. Create a .env.local file with the following content (depending on which demo you want to run)):
OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
STABILITY_API_KEY="YOUR_STABILITY_API_KEY"
  1. Run the following commands from the root directory of the modelfusion repo:
pnpm install
pnpm build
cd examples/nextjs
pnpm dev

Demos

Generate Image

Create an 19th century painting image for your input.

You need to set up the STABILITY_API_KEY environment variable to run this demo.

Go to http://localhost:3000/generate-image in your browser.

Generate Transcription

Record audio with push-to-talk and transcribe it using Whisper, implemented as a Next.js app. The app shows a list of the transcriptions.

You need to set up the OPENAI_API_KEY environment variable to run this demo.

Go to http://localhost:3000/generate-transcription in your browser.

Stream Objects through Server (OpenAI)

Generate travel itineraries using OpenAI

You need to set up the OPENAI_API_KEY environment variable to run this demo.

Go to http://localhost:3000/stream-object-openai in your browser.

Stream Objects on Client (Ollama)

Generate travel itineraries using Ollama

You need to install Ollama and download the openhermes model to run this demo.

Go to http://localhost:3000/stream-object-ollama in your browser.