Skip to content
프로젝트

소개

Ollama로 만든 AI 기반 로컬 타이핑 도우미입니다.

AI 및 머신러닝

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

AI powered typing assistant with Ollama

A script that can run in the background and listen to hotkeys, then uses a Large Language Model to fix the text. Less than 100 lines of code.

Inspired by this tweet:

https://twitter.com/karpathy/status/1725553780878647482

"GPT is surprisingly good at correcting minor typos, so you can write really really fast, ignore mistakes and keep going, and it comes out just fine." - Andrej Karpathy

You'll find a demo and step-by-step code explanations on my YouTube channel:

Alt text

Get Started

1. Set up Ollama

Ollama Installation: https://github.com/ollama/ollama

Run ollama run mistral:7b-instruct-v0.2-q4_K_S

Mistal 7B Instruct works well for this task, but feel free to try other models, too :)

2. Install dependencies

pip install pynput pyperclip httpx

3. Run it

Start the assistant:

python main.py

Hotkeys you can then press:

  • F9: Fixes the current line (without having to select the text)
  • F10: Fixes the current selection

Note: You may get an error the first time saying This process is not trusted! Input event monitoring will not be possible until it is added to accessibility clients. On Mac, you need to add the script (IDE/terminal) both on accessibility and input monitoring.

Note: The code works on macOS. The underlying shortcuts in the code like Cmd+Shift+Left, Cmd+C, Cmd+V might have to be changed for Linux & Windows (e.g. Key.cmd -> Key.ctrl).

Customize

Hotkeys, prompt, and Ollama config can be easily customized and extended in the code.

For example, here are some prompt templates you can try:

from string import Template

PROMPT_TEMPLATE_FIX_TEXT = Template(
    """Fix all typos and casing and punctuation in this text, but preserve all new line characters:

$text

Return only the corrected text."""
)

PROMPT_TEMPLATE_GENERATE_TEXT = Template(
    """Generate a snarky paragraph with 3 sentences about the following topic:

$text

Return only the corrected text."""
)

PROMPT_TEMPLATE_SUMMARIZE_TEXT = Template(
    """Summarize the following text in 3 sentences:

$text

Return only the corrected text."""
)

관련 프로젝트 살펴보기

불러오는 중…