Skip to content

Commit e1973b9

Browse files
authored
Merge pull request #1 from aalramadan/develop
Develop
2 parents 2df3ed5 + a9a57ba commit e1973b9

File tree

9 files changed

+466
-417
lines changed

9 files changed

+466
-417
lines changed

README.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
1-
# **SubGPT v1.0.0**
2-
<img width="943" alt="image" src="https://github.com/aalramadan/SubGPT/assets/55710790/81404e39-a31a-4b3f-b40e-0cf52e03851e">
1+
# **🛠 SubGPT**
2+
![alt text](image.png)
33

4-
## **What does it do?**
5-
**SubGPT** provides translations for *multiple* languages using ChatGPT.
4+
## **💡What does it do?**
5+
**SubGPT** provides translations for multiple languages using OpenAI's GPT.
66

77
## **ChatGPT Models Supported**
88

9-
- **gpt-3.5-turbo**
10-
- **gpt-4**
11-
9+
- **GPT 4o**
10+
- **GPT 4 Turbo**
11+
- **GPT 4**
12+
- **GPT 3 Turbo**
1213

1314
## **Features**
1415

15-
- **SubGPT** provides an option to specify the number of maximum input *tokens*. Higher number could lead to a better translation accuracy. Use according to your rate limit and subscription.
16+
- You can specify the number of **input tokens**.
1617

17-
- You can *pause/resume* translation at any point.
18+
- You can **pause/resume** translation at any point.
1819

19-
- You can *remove* and/or *edit* the translated output and the input. The tool will automatically align the non-empty rows.
20+
- You can **remove** and/or **edit** the translated output and the input. The tool will automatically align the rows.
2021

2122
- Final output along with the modifications can be saved as an *.srt*
2223

23-
## **Experimental**
24-
- SubGPT utilizes cosine similarity to compare the word embeddings between the input and final output using the *text-embedding-ada-002* model. A threshold between [-1, 1] where 1 indicates total semantic similarity and -1 indicates to semantic similarity at all.
25-
26-
- Higher tokens could lead to high translation accuracy, but may lead to incorrect alignments between the input and output. This option can fix the problem at the expense of using more tokens and time.
24+
- **SubGPT** utilizes cosine similarity to compare the word embeddings between the input and final output using the *text-embedding-ada-002* model. A threshold between [0, 1] where 1 indicates total semantic similarity and 0 indicates to semantic similarity at all.
2725

2826

2927
## **Demo**
30-
![Animation](https://github.com/aalramadan/SubGPT/assets/55710790/529fc1c0-91a8-47f8-bee5-664a17b675ba)
31-
32-
33-
## **Contribution**
34-
You can open an issue to discuss any errors or bugs or for general enhancements and suggestions.
28+
![Animation](https://github.com/aalramadan/SubGPT/assets/55710790/c465d7e4-5c1a-42ef-bc70-2a1ee7c3c25c)
3529

3630
## **Disclaimer**
37-
The SubGPT tool is an *experimental* tool provided for informational and educational purposes only. The accuracy and completeness of the output cannot be guaranteed.
31+
**SubGPT** is part of a collaborative research funded by the Arab Observatory for Translation (an affiliate of ALECSO), which is supported by the Literature, Publishing & Translation Commission in Saudi Arabia. </br>
3832

39-
SubGPT is part of a collaborative research between *Ali Al-Ramadan* and *Hussein Abu-Rayyash* to provide not only accurate but culturally nuanced translations using cosine similarity.
33+
> A research paper detailing this work was published at the **International Journal of Linguistics, Literature and Translation** and is available at:</br>
34+
https://al-kindipublisher.com/index.php/ijllt/article/view/7340/6298

build.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

compile/Inno_Setup_Script.iss

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
#define MyAppName "SubGPT"
5+
#define MyAppVersion "1.1.0"
6+
#define MyAppExeName "SubGPT.exe"
7+
#define MyAppAssocName MyAppName + " File"
8+
#define MyAppAssocExt ".myp"
9+
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
10+
11+
[Setup]
12+
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
13+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
14+
AppId={{6E5540FA-FE20-43AD-A6D2-CF10E19A0FB3}
15+
AppName={#MyAppName}
16+
AppVersion={#MyAppVersion}
17+
AppVerName={#MyAppName} {#MyAppVersion}
18+
DefaultDirName={autopf}\{#MyAppName}
19+
20+
; Specifies that Setup cannot run on anything but x64 and Windows 11 on Arm.
21+
ArchitecturesAllowed=x64compatible
22+
23+
; Requests that the install be done in "64-bit mode" on x64 or Windows 11 on Arm,
24+
; meaning it should use the native 64-bit Program Files directory and
25+
; the 64-bit view of the registry.
26+
ArchitecturesInstallIn64BitMode=x64compatible
27+
28+
ChangesAssociations=yes
29+
DisableProgramGroupPage=yes
30+
OutputBaseFilename=mysetup
31+
Compression=lzma
32+
SolidCompression=yes
33+
WizardStyle=modern
34+
35+
; Run in non administrative install mode (install for current user only.)
36+
PrivilegesRequired=lowest
37+
38+
SetupIconFile="C:\Users\Ali\Desktop\SubGPT\images\images\title_bar_icon_original.ico"
39+
40+
; Used to display version in installer properties
41+
VersionInfoVersion={#MyAppVersion}
42+
UninstallDisplayIcon="C:\Users\Ali\Desktop\SubGPT\images\images\title_bar_icon_original.ico"
43+
AppPublisher=aalramadan
44+
45+
46+
[Languages]
47+
Name: "english"; MessagesFile: "compiler:Default.isl"
48+
49+
[Tasks]
50+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
51+
52+
[Files]
53+
Source: "C:\Users\Ali\Desktop\SubGPT\dist\main\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
54+
Source: "C:\Users\Ali\Desktop\SubGPT\dist\main\_internal\*"; DestDir: "{app}\_internal"; Flags: ignoreversion recursesubdirs createallsubdirs
55+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
56+
57+
[Registry]
58+
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
59+
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
60+
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
61+
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
62+
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
63+
64+
[Icons]
65+
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
66+
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
67+
68+
[Run]
69+
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runasoriginaluser
70+
71+
72+
73+

compile/build.txt

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
Build (Windows):
2+
pyinstaller --windowed --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --icon="C:\Users\Ali\Desktop\SubGPT\images\images\title_bar_icon_original.ico" main.py
3+
4+
* Use for debugging --> --console instead of --windowed
5+
6+
#################################################################################
7+
Python packages used:
8+
annotated-types 0.7.0
9+
anyio 4.4.0
10+
cachetools 5.3.3
11+
certifi 2024.6.2
12+
charset-normalizer 3.3.2
13+
colorama 0.4.6
14+
contourpy 1.2.1
15+
cycler 0.12.1
16+
distro 1.9.0
17+
fonttools 4.53.0
18+
google-ai-generativelanguage 0.6.5
19+
google-api-core 2.19.0
20+
google-api-python-client 2.134.0
21+
google-auth 2.30.0
22+
google-auth-httplib2 0.2.0
23+
google-generativeai 0.7.0
24+
googleapis-common-protos 1.63.1
25+
grpcio 1.64.1
26+
grpcio-status 1.62.2
27+
h11 0.14.0
28+
httpcore 1.0.5
29+
httplib2 0.22.0
30+
httpx 0.27.0
31+
idna 3.7
32+
joblib 1.4.2
33+
kiwisolver 1.4.5
34+
matplotlib 3.9.0
35+
numpy 2.0.0
36+
openai 1.35.3
37+
packaging 24.1
38+
pandas 2.2.2
39+
pillow 10.3.0
40+
pip 24.1
41+
proto-plus 1.24.0
42+
protobuf 4.25.3
43+
pyasn1 0.6.0
44+
pyasn1_modules 0.4.0
45+
pydantic 2.7.4
46+
pydantic_core 2.18.4
47+
pyparsing 3.1.2
48+
PySide6 6.7.2
49+
PySide6_Addons 6.7.2
50+
PySide6_Essentials 6.7.2
51+
python-dateutil 2.9.0.post0
52+
pytz 2024.1
53+
qasync 0.27.1
54+
regex 2024.5.15
55+
requests 2.32.3
56+
rsa 4.9
57+
scikit-learn 1.5.0
58+
scipy 1.13.1
59+
shiboken6 6.7.2
60+
six 1.16.0
61+
sniffio 1.3.1
62+
srt 3.5.3
63+
threadpoolctl 3.5.0
64+
tiktoken 0.7.0
65+
tqdm 4.66.4
66+
typing_extensions 4.12.2
67+
tzdata 2024.1
68+
uritemplate 4.1.1
69+
urllib3 2.2.2

image.png

106 KB
Loading

main.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from qasync import QEventLoop
55
import ui_functions
66
import asyncio
7-
import ctypes
87

98
class MainWindow(QMainWindow, Ui_MainWindow):
109
def __init__(self):
@@ -19,24 +18,17 @@ def __init__(self):
1918

2019
self.btn_open.clicked.connect(lambda: ui_functions.load_template_file(self))
2120
self.btn_save.clicked.connect(lambda: ui_functions.save_template_file(self))
22-
2321
self.btn_next.clicked.connect(lambda: ui_functions.check_inputs(self))
24-
2522
self.btn_start.clicked.connect(lambda: ui_functions.communicate_with_api(self))
26-
2723
self.btn_back.clicked.connect(lambda: ui_functions.button_click(self, self.btn_back))
2824
self.btn_settings.clicked.connect(lambda: ui_functions.expand_settings(self))
2925
self.data_table.itemSelectionChanged.connect(lambda: ui_functions.items_selected(self))
3026
self.btn_delete_row.clicked.connect(lambda: ui_functions.delete_row(self))
3127
self.btn_info.clicked.connect(lambda: ui_functions.expand_about(self))
3228
self.box_cosine.stateChanged.connect(lambda: ui_functions.on_box_cosine_changed(self, self.box_cosine))
29+
3330
if __name__ == "__main__":
3431
app = QApplication()
35-
app.setStyle('Fusion')
36-
37-
# Needed to make Windows use an icon for SubGPT in the taskbar
38-
myappid = 'SubGPT.version.1.0'
39-
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
4032

4133
loop = QEventLoop(app)
4234
asyncio.set_event_loop(loop)

0 commit comments

Comments
 (0)