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

https://github.com/khip01/scanthesis

"What you see is what you copy." - Flutter desktop app with a customizable AI API, using Google Gemini to OCR code from images
https://github.com/khip01/scanthesis

ai-powered-tools flutter-desktop google-ai-studio linux-app ocr windows-app

Last synced: about 2 months ago
JSON representation

"What you see is what you copy." - Flutter desktop app with a customizable AI API, using Google Gemini to OCR code from images

Awesome Lists containing this project

README

          


Scanthesis - AI Code Extraction

🔍 Scanthesis App 🖥️


Extract code from images and get AI-powered responses



Flutter
Windows
Linux
Gemini 1.5 Flash
Customizable API



Scanthesis App Screenshots

## Overview
**Scanthesis** is a simple multi-platform desktop application built with Flutter, designed primarily for extracting code from images through AI-powered services. The app provides a straightforward interface similar to chat AI applications, with each interaction consisting of a single prompt and response.

## Features
- **Code Extraction from Images**: Convert code in images to text using AI services
- **Custom API Integration**: Connect to your preferred AI backend by configuring endpoints
- **Platform Support**:
- Fully tested and **functional on Windows 11 and Linux** (ubuntu/debian based)
- Built with Flutter for potential macOS compatibility _(untested)_
- **Simple Chat Interface**: Single prompt and response per chat session
- **Customizable Backend**: Use the included Golang API example (using Gemini 1.5 Flash) or configure your own AI service
- **Markdown Output**: Receive AI responses formatted in Markdown

## Development Requirements

### Environment Setup
- **Flutter**: Version 3.32.4 or above
- **Supported Development Platforms**:
- **Windows**: Windows 11 Home 23H2 with Android Studio Hedgehog | 2023.1.1 Patch 2
- **Linux**: Ubuntu/Debian based systems (Tested on KDE Plasma 6 Wayland) with Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
- **Additional Tools**:
- Postman (for API testing)

### Prerequisites
Before running the application, ensure your Flutter environment is properly configured:

```bash
# Verify Flutter installation and dependencies
flutter doctor
```

Make sure all platform-specific requirements are met:
- For Windows: Windows desktop development is enabled
- For Linux: Linux desktop development is enabled

```bash
# Enable desktop development
flutter config --enable-windows-desktop
flutter config --enable-linux-desktop
```

## Technical Implementation
This application serves as a desktop interface for AI services, allowing you to:
- Configure API endpoints in the settings page
- Use the included Golang backend example (requires your API key)
- Customize the JSON response structure to work with different AI providers

## Getting Started

### Option 1: Using the Built-in Golang API

The repository includes a simple Golang API implementation that connects to Gemini 1.5 Flash:

1. Navigate to the `scanthesis_api` directory
2. Copy `.env.example` to create a new `.env` file
3. Configure your environment variables in the `.env` file:
```
API_KEY="your_api_key_here"
ENDPOINT="http://127.0.0.1:8080/api"
```
> [!NOTE]
> You can obtain an API key from [Google AI Studio](https://aistudio.google.com/apikey)
4. Run the API server:
```
go run main.go
```
5. Launch the Scanthesis desktop application and configure the endpoint URL in the settings page to match your API server (default: `http://127.0.0.1:8080/api`)

### Option 2: Using a Custom API

If you prefer to use your own AI backend:

1. Launch the Scanthesis application and navigate to the settings page
2. Enter your custom API endpoint URL in the designated field


Scanthesis settings - API Endpoint

3. If your API returns a different JSON structure than the default, you'll need to modify the response model:

Open `scanthesis_app/lib/models/api_response.dart` and customize the `MyCustomResponse` class to match your API's response structure:

```dart
class MyCustomResponse {
final String response;
// Add or modify fields according to your JSON response structure

MyCustomResponse({required this.response});

factory MyCustomResponse.fromJson(Map json) {
return MyCustomResponse(response: json['response']);
}

Map toJson() => {"response": response};

@override
String toString() => response;
}
```

> [!NOTE]
> The application is configured to send requests with the structure defined in `scanthesis_app/lib/models/api_request.dart`. Customizing the request format is not fully supported in the current version.

## API Request Format

For reference, the application sends requests in the following format:

```json
{
"files": ["path/to/file1.jpg", "path/to/file2.png"],
"prompt": "User's text prompt"
}
```

Ensure your custom API can handle this format or modify the request model in the source code if necessary.