buraktrk commited on
Commit
6a43a2f
·
verified ·
1 Parent(s): 4acce00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -198,6 +198,8 @@ def generate_keys():
198
 
199
 
200
  def encrypt_excel(file):
 
 
201
  global encrypted_input
202
  if client is None:
203
  raise gr.Error("Lütfen önce 'Anahtar Oluştur'a tıklayın.")
@@ -245,7 +247,7 @@ def run_fhe():
245
  encrypted_result.append(result)
246
 
247
  encrypted_output = encrypted_result
248
- return f"{len(encrypted_output)} satır için tahmin tamamlandı."
249
 
250
 
251
 
@@ -288,7 +290,7 @@ def decrypt_result():
288
  predictions = []
289
  for enc in encrypted_output:
290
  pred = client.deserialize_decrypt_dequantize(enc)
291
- label = encoder.inverse_transform([int(pred[0])])[0]
292
  predictions.append(label)
293
 
294
  return "\n".join(f"{i+1}. {label}" for i, label in enumerate(predictions))
 
198
 
199
 
200
  def encrypt_excel(file):
201
+ if file is None:
202
+ raise gr.Error("Lütfen önce bir Excel dosyası yükleyin.")
203
  global encrypted_input
204
  if client is None:
205
  raise gr.Error("Lütfen önce 'Anahtar Oluştur'a tıklayın.")
 
247
  encrypted_result.append(result)
248
 
249
  encrypted_output = encrypted_result
250
+ return "Tahmin başarıyla tamamlandı."
251
 
252
 
253
 
 
290
  predictions = []
291
  for enc in encrypted_output:
292
  pred = client.deserialize_decrypt_dequantize(enc)
293
+ label = encoder.inverse_transform([int(pred.flatten()[0])])[0]
294
  predictions.append(label)
295
 
296
  return "\n".join(f"{i+1}. {label}" for i, label in enumerate(predictions))