https://github.com/lyqht/cloudflare-journal
https://github.com/lyqht/cloudflare-journal
api-routes cloudflare-workers nextjs openai whisper-ai
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lyqht/cloudflare-journal
- Owner: lyqht
- License: mit
- Created: 2024-04-04T13:41:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-11T14:16:56.000Z (about 1 year ago)
- Last Synced: 2025-04-14T16:02:21.676Z (15 days ago)
- Topics: api-routes, cloudflare-workers, nextjs, openai, whisper-ai
- Language: TypeScript
- Homepage: https://cf-journal.vercel.app/
- Size: 2.54 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction
This project is a **Cloudflare serverless worker** with an AI service binding deployed for processing either audio, image or text submitted by users into semantic useful information, especially in the context for _submitting expenses_.
For users that prefer a UI, a simple **NextJS web app** is created to demonstrate how to upload files and utilizes API routes to make a POST request to the Cloudflare worker endpoint.
## How it works

## Models used
From [Cloudflare AI Models](https://developers.cloudflare.com/workers-ai/models):
- Image-to-text: [@cf/unum/uform-gen2-qwen-500m](https://developers.cloudflare.com/workers-ai/models/uform-gen2-qwen-500m/)
- Automatic Speech Recognition: [@cf/openai/whisper](https://developers.cloudflare.com/workers-ai/models/whisper/)
- Text Generation: [@hf/thebloke/mistral-7b-instruct-v0.1-awq](https://developers.cloudflare.com/workers-ai/models/mistral-7b-instruct-v0.1/)## Try out the worker!
The worker is deployed at https://cf-journal.senchatea.workers.dev.
Text input
```bash
curl --location 'https://cf-journal.senchatea.workers.dev?type=text' \
--header 'Content-Type: text/plain' \
--data '2 weeks ago, I went to eat a buffet at Swensens Unlimited at the T2 airport, it'\''s really nice but it costs like $36 per person after GST, and there were 2 of us.'
```Audio input
```bash
curl --location 'https://cf-journal.senchatea.workers.dev?type=audio' \
--header 'Content-Type: application/octet-stream' \
--header 'Authorization: Bearer pYrzMvsyURxsCUeaQDsa3lSO_tBDQEuiPB3iLEQt' \
--data '@postman-cloud:///1eef4b5b-a64c-4c10-ad4b-5f22c528880b'
```Image input
```bash
curl --location 'https://cf-journal.senchatea.workers.dev?type=image' \
--header 'Content-Type: application/octet-stream' \
--header 'Authorization: Bearer pYrzMvsyURxsCUeaQDsa3lSO_tBDQEuiPB3iLEQt' \
--data '@postman-cloud:///1eef4b68-e5d7-49e0-a28d-f60b3bd7d70e'
```## Try it in the web app!

## Resources
These are some resources from Cloudflare that I read up to work on this project.
- [Workers AI LLM Playground](https://playground.ai.cloudflare.com/)
- [Guide on choosing the right
text generation model](https://developers.cloudflare.com/workers-ai/tutorials/how-to-choose-the-right-text-generation-model/)