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: 3 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
- Host: GitHub
- URL: https://github.com/khip01/scanthesis
- Owner: Khip01
- Created: 2025-04-18T14:31:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-13T15:11:55.000Z (10 months ago)
- Last Synced: 2025-09-13T16:42:36.174Z (10 months ago)
- Topics: ai-powered-tools, flutter-desktop, google-ai-studio, linux-app, ocr, windows-app
- Language: Dart
- Homepage: https://khip01.github.io/me/#/creation/details?id=2pcF
- Size: 2.4 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
π Scanthesis App π₯οΈ
Extract code from images and get AI-powered responses
## 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
## 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
### So? What do you want to do with this repository? π€ π
I want to install this cool app on my device so I can use it ππΌπ
## Getting Started
You can use either your own [My Custom API (Option 2)](#option-2-using-a-custom-api), or the [Simple Built-in Golang API that comes with this project (Option 1)](#option-1-using-the-built-in-golang-api) _(without the pain of creating your own API and manually editing the source code)_.
### Option 1: Using the Built-in Golang API
The repository includes a simple Golang API implementation that connects to Gemini 1.5 Flash.
1. __Download the separate API from the [latest release](https://github.com/Khip01/Scanthesis/releases) according to your operating system (Windows/Linux).__
2. __Run the API server using command-line arguments for endpoint and API key:__
```bash
# Linux/macOS
./scanthesis_api --endpoint="localhost:8080" --api_key="your_api_key_here"
```
```cmd
:: Windows
scanthesis_api.exe --endpoint="localhost:8080" --api_key="your_api_key_here"
```
```bash
# Or if you want to build from source (inside scanthesis_api folder from this project):
go run main.go --endpoint="localhost:8080" --api_key="your_api_key_here"
```
> __βΉοΈ NOTE__ \
> You can obtain an API key from [Google AI Studio](https://aistudio.google.com/apikey)
3. If __you are running this app on Linux__, youβll need to install some additional libraries so that the `tray_manager` (system tray) and `hotkey_manager` (global hotkeys) plugins work correctly. You can see the installation tutorial for the [__REQUIRED System Dependencies__ in the following release section](https://github.com/Khip01/Scanthesis/releases).
4. Launch the Scanthesis desktop application and configure the endpoint URL in the settings page to match your API server (default: `http://localhost:8080/api`).
5. After that, you're __ready to use the app__ π₯π
### Option 2: Using a Custom API
If you prefer to use your own AI backend:
1. If __you are running this app on Linux__, youβll need to install some additional libraries so that the `tray_manager` (system tray) and `hotkey_manager` (global hotkeys) plugins work correctly. You can see the installation tutorial for the [__REQUIRED System Dependencies__ in the following release section](https://github.com/Khip01/Scanthesis/releases).
2. Launch the Scanthesis application and navigate to the settings page
3. Enter your custom API endpoint URL in the designated field
4. __If your API response returns a JSON structure that differs__ from the default JSON of this application, you'll need to manually modify the response model code of this app:
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;
}
```
5. Then build the application according to the [build instructions here](#development-requirements) as a developer π€.
5. After that, you're ready to use the app π₯π
> __βΉοΈ 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.
For reference, the application sends requests in the following format:
_Contents of the JSON Request Structure from Scanthesis to the API_
```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.
I want to develop and understand this application as a developer, so i can contribute βοΈπ€
## 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
```
#### Linux System Dependencies
If developing on Linux, you'll need to install additional system packages for certain Flutter plugins:
```bash
# For tray_manager plugin (system tray functionality)
# For Ubuntu/Debian-based distributions
sudo apt-get install libayatana-appindicator3-dev
# OR alternative package (for older distributions)
sudo apt-get install appindicator3-0.1 libappindicator3-dev
# For hotkey_manager plugin (keyboard shortcuts)
sudo apt-get install keybinder-3.0
```
These packages are required for the application's system tray and global hotkey functionality to work correctly.
## Linux Build Instruction
Scanthesis provides a convenient way to build and package the application for various Linux distributions. The included scripts automatically create packages for Debian-based systems (.deb), Fedora/RHEL (.rpm), Arch Linux (.tar.zst), and a universal AppImage.
### Building Linux Packages
To build the application for Linux and create distribution packages:
1. Navigate to the `scanthesis_app` directory
2. Run the build and package script:
```bash
cd scanthesis_app
chmod +x build_and_package_linux.sh
./build_and_package_linux.sh
```
3. The packages will be created in the linux_packages directory:
- `scanthesis_1.0.0_amd64.deb` - For Debian, Ubuntu, Linux Mint, etc.
- `rpm_output/scanthesis-1.0.0-1.fc42.x86_64.rpm` - For Fedora, RHEL, CentOS, etc.
- `scanthesis-1.0.0-1-x86_64.pkg.tar.zst` - For Arch Linux, Manjaro, etc.
- `scanthesis_1.0.0-x86_64.AppImage` - Universal Linux package
### Installation from Packages
#### Debian/Ubuntu and derivatives:
```bash
sudo dpkg -i linux_packages/scanthesis_1.0.0_amd64.deb
```
#### Fedora/RHEL and derivatives:
```bash
sudo rpm -i linux_packages/rpm_output/scanthesis-1.0.0-1.fc42.x86_64.rpm
```
#### Arch Linux and derivatives:
```bash
sudo pacman -U linux_packages/scanthesis-1.0.0-1-x86_64.pkg.tar.zst
```
#### Any Linux distribution (AppImage):
```bash
chmod +x linux_packages/scanthesis_1.0.0-x86_64.AppImage
./linux_packages/scanthesis_1.0.0-x86_64.AppImage
```
### Advanced Options
The packaging script supports several options:
```bash
./build_and_package_linux.sh --help
```
Common options include:
- `--app-name NAME`: Set the application name (default: scanthesis)
- `--version VERSION`: Set the application version (default: 1.0.0)
- `--icon PATH`: Path to the application icon (default: assets/app_icon/scanthesis-app-icon-600x600.png)
- `--force-docker`: Use Docker for all package formats regardless of native tools
- `--no-docker`: Don't use Docker even if native tools are missing
## Windows Build Instruction
Scanthesis also provides a way to create a Windows installer using Inno Setup.
### Building Windows Installer
To create a Windows installer:
1. Make sure you have [Inno Setup](https://jrsoftware.org/isinfo.php) installed
2. Build the Flutter application for Windows:
```bash
cd scanthesis_app
flutter build windows --release
```
3. Run the Inno Setup script file (located at `windows/installer/scanthesis_build_installer.iss`) using the Inno Setup Compiler
4. The installer will be created in the `windows/installer` folder named `scanthesis_setup_v{version}.exe` (where `{version}` is the version defined in the .iss file)
### Installer Configuration
If you want to customize the installer, you can modify the `windows/installer/scanthesis_build_installer.iss` file. This file contains the configuration for creating the Windows installer, including application information, files to include, and installation options.