Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KNIGHT
ASYST
Commits
4c36806b
Commit
4c36806b
authored
Mar 16, 2025
by
Kaif Siddique
Browse files
1.Remove the commented code which was not needed 2. Updated Executable File
parent
304ec6fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/main.py
View file @
4c36806b
import
tkinter
as
tk
import
tkinter
as
tk
from
tkinter
import
filedialog
from
tkinter
import
filedialog
from
tkinter
import
BOTTOM
,
RIDGE
,
RIGHT
,
Label
,
Menu
,
Toplevel
,
ttk
from
tkinter
import
BOTTOM
,
RIDGE
,
RIGHT
,
Label
,
Menu
,
Toplevel
,
ttk
from
tkinter.messagebox
import
showwarning
from
tkinter.font
import
NORMAL
from
tkinter.font
import
NORMAL
from
tkinter.messagebox
import
showinfo
from
tkinter.messagebox
import
showinfo
from
tkinter.filedialog
import
askopenfilename
from
tkinter.filedialog
import
askopenfilename
...
@@ -11,17 +10,11 @@ import csv
...
@@ -11,17 +10,11 @@ import csv
import
xlsxwriter
import
xlsxwriter
import
tkinter
import
tkinter
##import sentence_transformers
import
pandas
as
pd
import
pandas
as
pd
import
sys
import
sys
import
os
import
os
#from sklearn.metrics import f1_score
from
Skript.german.run_LR_SBERT
import
main
as
backend
#from matplotlib import pyplot as plt
#from sklearn.metrics import confusion_matrix, classification_report
#import seaborn as sns
# from Skript.english.run_SAG_mnli import main as english_backend
from
Skript.german.run_LR_SBERT
import
main
as
german_backend
class
App
(
ttk
.
Frame
):
class
App
(
ttk
.
Frame
):
...
@@ -34,8 +27,6 @@ class App(ttk.Frame):
...
@@ -34,8 +27,6 @@ class App(ttk.Frame):
self
.
columnconfigure
(
index
=
index
,
weight
=
1
)
self
.
columnconfigure
(
index
=
index
,
weight
=
1
)
self
.
rowconfigure
(
index
=
index
,
weight
=
1
)
self
.
rowconfigure
(
index
=
index
,
weight
=
1
)
# # # Create value list
# self.combo_list = ["Choose language of input data", "English", "German"]
#Create a label
#Create a label
self
.
label
=
tk
.
Label
(
root
,
text
=
"Please upload an Excel file:"
,
font
=
(
"Arial"
,
12
,
"bold"
))
self
.
label
=
tk
.
Label
(
root
,
text
=
"Please upload an Excel file:"
,
font
=
(
"Arial"
,
12
,
"bold"
))
...
@@ -133,69 +124,10 @@ class App(ttk.Frame):
...
@@ -133,69 +124,10 @@ class App(ttk.Frame):
font
=
(
"Segoeui 20 bold"
))
font
=
(
"Segoeui 20 bold"
))
lab
.
pack
(
padx
=
0
,
pady
=
35
)
lab
.
pack
(
padx
=
0
,
pady
=
35
)
# container = ttk.Frame(new_window)
# canvas = tk.Canvas(container)
# scrollbary = ttk.Scrollbar(container, orient='vertical', command=canvas.yview)
# scrollbar = ttk.Scrollbar(container, orient="horizontal", command=canvas.xview)
# scrollable_frame = ttk.Frame(canvas)
# scrollable_frame.bind(
# "<Configure>",
# lambda e: canvas.configure(
# scrollregion=canvas.bbox("all")
# )
# )
# canvas.configure(scrollregion=canvas.bbox("all"))
# canvas.create_window((4, 4), window=scrollable_frame)
csv_file_path
=
resource_path
(
"Skript
\\
outputs
\\
predictions.txt"
);
#############
# Read the csv file and parse it into the table
# with open((csv_file_path), "r", newline="", encoding="utf8") as f:
#
# reader = csv.reader(f, delimiter="\t")
# r = 0
# for col in reader:
# c = 0
# for row in col:
# # variable column width
# col_width = 65
# anch = 'center'
# match c:
# case 0:
# col_width = 10 # ID is short
# anch = 'w'
# case 3:
# col_width = 20 # label is short
# anch = 'w'
# case 4:
# col_width = 20 # label is short
# anch = 'w'
#
# label = Label(scrollable_frame, width=col_width, height=4, text=row, wraplength=500,
# anchor=anch, relief=RIDGE,
# font=("Segoeui 10"))
# label.grid(row=r + 1, column=c + 1)
# string_c = "incorrect"
# if string_c in row:
# label.config(bg="red")
# c += 1
# r += 1
#
# canvas.config(height=500, width=1500, xscrollcommand=scrollbar.set, yscrollcommand=scrollbary.set)
# canvas.configure(xscrollcommand=scrollbar.set, yscrollcommand=scrollbary.set)
# scrollbary.pack(side=RIGHT, fill=tk.Y)
# scrollbar.pack(side=BOTTOM, fill=tk.X)
################################
save_button
=
ttk
.
Button
(
new_window
,
text
=
"Save as ..."
,
command
=
save_as_excel
)
save_button
=
ttk
.
Button
(
new_window
,
text
=
"Save as ..."
,
command
=
save_as_excel
)
save_button
.
pack
(
side
=
BOTTOM
,
expand
=
True
)
save_button
.
pack
(
side
=
BOTTOM
,
expand
=
True
)
# container.pack(padx=30, pady=15, fill="both", expand=True)
# canvas.pack(fill="both", expand=True)
def
save_as_excel
():
def
save_as_excel
():
...
@@ -251,20 +183,7 @@ class App(ttk.Frame):
...
@@ -251,20 +183,7 @@ class App(ttk.Frame):
self
.
button2
.
config
(
state
=
DISABLED
)
self
.
button2
.
config
(
state
=
DISABLED
)
root
.
update
()
root
.
update
()
# start the correct backend pipeline
backend
()
# if self.combobox.get() == 'English':
# showinfo(
# title="Information",
# message="Generating grade suggestions for English student answers. This may take a little while.")
# # run English backend
# english_backend()
# elif self.combobox.get() == 'German':
# showinfo(
# title="Information",
# message="Generating grade suggestions for German student answers. This may take a little while.")
# # run German/multilingual backend
# german_backend()
german_backend
()
self
.
button1
.
config
(
state
=
NORMAL
)
self
.
button1
.
config
(
state
=
NORMAL
)
self
.
button2
.
config
(
state
=
NORMAL
)
self
.
button2
.
config
(
state
=
NORMAL
)
...
@@ -276,26 +195,9 @@ class App(ttk.Frame):
...
@@ -276,26 +195,9 @@ class App(ttk.Frame):
self
.
button2
=
ttk
.
Button
(
self
.
widgets_frame
,
text
=
"Input file"
,
command
=
import_csv_data
,
state
=
"normal"
)
self
.
button2
=
ttk
.
Button
(
self
.
widgets_frame
,
text
=
"Input file"
,
command
=
import_csv_data
,
state
=
"normal"
)
self
.
button2
.
grid
(
row
=
9
,
column
=
0
,
padx
=
5
,
pady
=
10
,
sticky
=
"nsew"
)
self
.
button2
.
grid
(
row
=
9
,
column
=
0
,
padx
=
5
,
pady
=
10
,
sticky
=
"nsew"
)
# select language, "Choose language" as default
# self.combobox = ttk.Combobox(
# self.widgets_frame, values=self.combo_list)
# self.combobox.current(0)
# self.combobox.grid(row=5, column=0, padx=5, pady=10, sticky="ew")
self
.
label
=
tk
.
Label
(
self
.
widgets_frame
,
text
=
"Please upload an Excel file:"
,
font
=
(
"Arial"
,
12
,
"bold"
))
self
.
label
=
tk
.
Label
(
self
.
widgets_frame
,
text
=
"Please upload an Excel file:"
,
font
=
(
"Arial"
,
12
,
"bold"
))
self
.
label
.
grid
(
row
=
5
,
column
=
0
,
padx
=
5
,
pady
=
10
,
sticky
=
"w"
)
self
.
label
.
grid
(
row
=
5
,
column
=
0
,
padx
=
5
,
pady
=
10
,
sticky
=
"w"
)
# set state for button2("Input"-button) and if 'Spanish' is chosen in the combobox disable both buttons
# def set_buttons_state(event):
# self.button2.config(state="normal")
# print('State changed')
# if self.combobox.get() == 'Spanish':
# showwarning(title="Information", message="Not available")
# self.button1.config(state="disabled")
# self.button2.config(state="disabled")
# get events from changing combobox
# self.combobox.bind('<<ComboboxSelected>>', set_buttons_state)
self
.
button1
=
ttk
.
Button
(
self
.
widgets_frame
,
text
=
"Start"
,
self
.
button1
=
ttk
.
Button
(
self
.
widgets_frame
,
text
=
"Start"
,
command
=
start_progress
,
command
=
start_progress
,
state
=
tk
.
DISABLED
)
state
=
tk
.
DISABLED
)
...
@@ -331,10 +233,6 @@ if __name__ == "__main__":
...
@@ -331,10 +233,6 @@ if __name__ == "__main__":
if
sys
.
stderr
is
None
:
if
sys
.
stderr
is
None
:
sys
.
stderr
=
NullWriter
()
sys
.
stderr
=
NullWriter
()
# if sys.stdout is None:
# sys.stdout = open(os.devnull, "w")
# if sys.stderr is None:
# sys.stderr = open(os.devnull, "w")
root
=
tk
.
Tk
()
root
=
tk
.
Tk
()
root
.
title
(
"ASYST"
)
root
.
title
(
"ASYST"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment