Spaces:
Runtime error
Runtime error
xiomarablanco
commited on
Commit
·
b4bfa74
1
Parent(s):
1dcd702
Update app.py
Browse files
app.py
CHANGED
@@ -90,27 +90,31 @@ def Main(uploadedFile, txtFileInput, orthographyPercentage, syntaxPercentage, se
|
|
90 |
return [error, excelPath]
|
91 |
|
92 |
def exportResultToExcelFile(modelResult):
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
|
104 |
#tableResults = tablib.Dataset(headers=('ID', 'SimilitudSpacy', 'SimilitudBert', 'NotaSemanticaSpacy', 'NotaSemanticaBert', 'NotaSintaxis', 'NotaOrtografia','NotaTotalSpacy','NotaTotalBert','Feedback'))
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
114 |
return outputFilePath
|
115 |
|
116 |
def copySpanishDictionaries():
|
|
|
90 |
return [error, excelPath]
|
91 |
|
92 |
def exportResultToExcelFile(modelResult):
|
93 |
+
try:
|
94 |
+
excelData = []
|
95 |
+
|
96 |
+
studentsArray = modelResult[0]
|
97 |
+
index = 0
|
98 |
+
for item in studentsArray:
|
99 |
+
#print("ITEM - " + str(item))
|
100 |
+
studentData = item[index]
|
101 |
+
excelData.append(studentData)
|
102 |
+
index+= 1
|
103 |
|
104 |
#tableResults = tablib.Dataset(headers=('ID', 'SimilitudSpacy', 'SimilitudBert', 'NotaSemanticaSpacy', 'NotaSemanticaBert', 'NotaSintaxis', 'NotaOrtografia','NotaTotalSpacy','NotaTotalBert','Feedback'))
|
105 |
+
tableResults = tablib.Dataset(headers=('ID', 'SumaTotalSpacy', 'SumaTotaldBert', 'NotaSemanticaSpacy', 'NotaSemanticaBert', 'NotaSintaxis', 'NotaOrtografia','NotaTotalSpacy','NotaTotalBert','Feedback'))
|
106 |
+
|
107 |
+
tableResults.json=json.dumps(excelData)
|
108 |
+
tableExport=tableResults.export('xlsx')
|
109 |
+
outputFilePath = './output/' + str(datetime.now().microsecond) + '_plentas_output.xlsx'
|
110 |
+
# outputFilePath = './output/plentas_output.xlsx'
|
111 |
+
with open(outputFilePath, 'wb') as f: # open the xlsx file
|
112 |
+
f.write(tableExport) # write the dataset to the xlsx file
|
113 |
+
f.close()
|
114 |
+
|
115 |
+
except Exception as e:
|
116 |
+
print("Error exportando Excel:"+ str(e))
|
117 |
+
|
118 |
return outputFilePath
|
119 |
|
120 |
def copySpanishDictionaries():
|