Skip to content

Commit

Permalink
Merge pull request #1 from recoskyler/recoskyler-gui
Browse files Browse the repository at this point in the history
GUI
  • Loading branch information
recoskyler authored Sep 1, 2023
2 parents c13b78c + c980448 commit e7e4724
Show file tree
Hide file tree
Showing 14 changed files with 1,221 additions and 554 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,6 @@ pip-selfcheck.json

*.xlsx
*.xlsm
*.ods
*.ods

SheetGPT
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"flet",
"kivy",
"openai",
"openpyxl",
Expand Down
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
# SheetGPT

<img src="https://github.com/recoskyler/sheetGPT/blob/main/icon.png" data-canonical-src="https://github.com/recoskyler/sheetGPT/blob/main/icon.png" width="128" height="128" />

A visual tool for completing a specific column/row using the data from other columns/rows in a XLSX/XLSM file utilizing ChatGPT.

## Status

Still in development, but can be used.

## Usage

1. Go to releases, and download the latest executable suitable for your platform.
2. Launch the executable.
3. Choose an input file.
4. Choose an output file.
5. Choose the sheet you would like to use.
6. Enter the input column(s)/row(s), separated by a comma "," or a space " " character. (*i.e. `a,b,c` or `1 2 5`*)
7. Enter the input starting position. You must enter a row if you have entered a column in the previous step, vice-versa.
8. *(Optional) Enter the input ending position. You must enter a row if you have entered a column in the previous step, vice-versa. SheetGPT will stop once it reaches this position (inclusive).*
9. Enter the output column and row.
10. Choose the output placement strategy (place the result on the next row, or column).
11. Enter your OpenAI API key. You can create one [here](https://platform.openai.com/account/api-keys).
12. Choose the ChatGPT model you would like to use.
13. Enter a system prompt to fine-tune the model to your needs. You can also use the default system prompt.
14. Enter a prompt to be used with each request. You can use `$0`, `$1`... placeholders (*zero-indexed, starting from 0*) to insert the inputs you have specified on the 6th step above.
15. *(Optional) Enter a processing limit, enter `0` to remove the limit. Only the items which were processed explicitly by ChatGPT will count towards the limit. Cached results, or existing results (if you leave* **Skip the existing results** *enabled) will not count towards the limit.*
16. Press **Start processing** to start. This might take a while depending on the data volume and device specs.

## Requirements

- Python 3.7/3.8
- Python 3.7+
- pip
- venv
- Flet
- ezpyi (for creating AppImage)

## Development

Expand Down Expand Up @@ -59,3 +82,35 @@ Still in development, but can be used.
```bash
python3 main.py
```

Or to use hot-reload

```bash
flet run -d main.py
```

### Packaging

#### Executable

Executable will be created for your platform (for Linux if you run it on Linux, for Windows if you run it on Windows...).

```bash
flet pack main.py --icon icon.png --name SheetGPT --add-data "modules:modules"
```

#### AppImage

An AppImage will be created to be used with Linux.

```bash
ezpyi -A -i icon.png main.py SheetGPT
```

## [LICENSE](https://github.com/recoskyler/sheetGPT/blob/main/LICENSE)

[MIT License](https://github.com/recoskyler/sheetGPT/blob/main/LICENSE)

## About

Made by [recoskyler](https://github.com/recoskyler) - 2023
10 changes: 1 addition & 9 deletions modules/assistant.py → assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

def get_formatted_prompt(prompt: str, input_values: object) -> str:
formatted_prompt = prompt
index = int(search("(\$)([0-9]+)", formatted_prompt).group()[1:])

while search("(\$)([0-9]+)", formatted_prompt) != None:
match = search("(\$)([0-9]+)", formatted_prompt).group()
Expand All @@ -24,13 +23,8 @@ def get_formatted_prompt(prompt: str, input_values: object) -> str:

return formatted_prompt

def get_answer(prompt: str, system_prompt: str, model: str, api_key: str, cache: object) -> tuple:
def get_answer(prompt: str, system_prompt: str, model: str, api_key: str) -> tuple:
openai.api_key = api_key
prompt_hash = str(hash(prompt))

if prompt_hash in cache.keys():
print("Using cached answer...")
return (cache[prompt_hash], 0)

try:
print("Getting answer from ChatGPT...")
Expand All @@ -41,6 +35,4 @@ def get_answer(prompt: str, system_prompt: str, model: str, api_key: str, cache:
print(e)
return ("", 0)

cache[prompt_hash] = res

return (res, 1)
2 changes: 1 addition & 1 deletion modules/cell.py → cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_numeric_value(coordinate: str) -> int:
elif coordinate.isnumeric():
return int(coordinate)
else:
raise Exception("Invalid coordinate. Must be numeric (1), or alphabetic (A). Not both (A1)")
raise Exception("Invalid coordinate. Must be numeric (1), or alphabetic (A). Not both (A1): ", coordinate)

def get_cell_value(worksheet, cell: str):
if worksheet == None:
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e7e4724

Please sign in to comment.