An open API service indexing awesome lists of open source software.

https://github.com/fboucher/caption-this

Examples in C#, Python, and HTTP for using the Reka Vision API to caption images and videos.
https://github.com/fboucher/caption-this

ai captioning-images csharp demo dotnet http python sample vision vscode

Last synced: 12 days ago
JSON representation

Examples in C#, Python, and HTTP for using the Reka Vision API to caption images and videos.

Awesome Lists containing this project

README

          

# Caption This

Examples in C#, Python, and HTTP for using the Reka Vision API to caption images and videos. See https://docs.reka.ai/vision for API details.

## Prerequisites

- Copy `.env-sample` to `.env` and set your API keys.
- `API_KEY`: Required for Reka Vision API (it's free! [Get yours from here](https://link.reka.ai/free))
- `GOOGLE_API_KEY`: Required for video generation in Python.

## Samples

This repository contains similar/ equivalent samples in multiple languages for captioning images and videos using the Reka Vision API.

It also includes small image and video assets for testing in the `assets/` folder.

### Python

In the `/python` folder, there are three Python scripts that demonstrate the Reka Vision API:

**Installation:**

```bash
pip install -r python/requirements.txt
```

**Scripts:**

- **[caption_this.py](python/caption_this.py)** - Caption a video file and save the result to JSON

```bash
python python/caption_this.py ../assets/test-b.mp4
```

- **[vision_app.py](python/vision_app.py)** - Interactive CLI application for managing images and videos (list, upload, caption, delete)

```bash
python python/vision_app.py
```

- **[create_video.py](python/create_video.py)** - Generate AI video using Google's Generative AI (requires `GOOGLE_API_KEY`)

```bash
python python/create_video.py
```

Note: Edit the prompt in the script before running.

### C# - File-based

In the `/dotnet` folder, there the `caption-this.cs` file-based program that can caption a single image or video file. You can run it from the command line:

```bash
dotnet ./caption-this.cs ../assets/test-a.png
```

### C# - Spectre Console App

In the `/spectre` folder, there's a full-featured interactive console application built with [Spectre.Console](https://spectreconsole.net/). This app provides a rich terminal UI with menus, tables, spinners, and progress bars for working with the Reka Vision API.

**Run the app:**

```bash
cd spectre
dotnet run
```

### HTTP

In the `/http` folder, there's a [caption-this.http](http/caption-this.http) file that contains REST API examples using the [VS Code REST Client extension](https://marketplace.visualstudio.com/items?itemName=humao.rest-client).

**Available requests:**

- List all videos in library
- List all images
- Caption a video by ID
- Caption an image by URL or ID
- Upload a video file
- Upload a photo file
- Delete a video by ID

**Usage:**
Open [caption-this.http](http/caption-this.http) in VS Code and click "Send Request" above any request.

## Questions or Issues

If you have any questions or run into issues, please open an issue on the GitHub repository or reach out on our - [Discord Community](https://link.reka.ai/discord)