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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -231,8 +231,10 @@ def encrypt_excel(file):
231
 
232
 
233
 
 
 
234
  def run_fhe():
235
- global server, encrypted_output
236
  if encrypted_input is None:
237
  raise gr.Error("Veri şifrelenmemiş.")
238
 
@@ -247,8 +249,8 @@ def run_fhe():
247
  encrypted_result.append(result)
248
 
249
  encrypted_output = encrypted_result
250
- return "Tahmin başarıyla tamamlandı."
251
-
252
 
253
 
254
  simulate_prediction = []
@@ -284,9 +286,14 @@ def show_simulate_result():
284
 
285
 
286
  def decrypt_result():
 
 
 
 
 
287
  if encrypted_output is None:
288
- raise gr.Error("Henüz tahmin yapılmadı.")
289
-
290
  predictions = []
291
  for enc in encrypted_output:
292
  pred = client.deserialize_decrypt_dequantize(enc)
 
231
 
232
 
233
 
234
+ fhe_prediction_ready = False
235
+
236
  def run_fhe():
237
+ global server, encrypted_output, fhe_prediction_ready
238
  if encrypted_input is None:
239
  raise gr.Error("Veri şifrelenmemiş.")
240
 
 
249
  encrypted_result.append(result)
250
 
251
  encrypted_output = encrypted_result
252
+ fhe_prediction_ready = True # 🎯 flag aktif ediliyor
253
+ return "Gerçek tahmin tamamlandı."
254
 
255
 
256
  simulate_prediction = []
 
286
 
287
 
288
  def decrypt_result():
289
+ global fhe_prediction_ready
290
+
291
+ if not fhe_prediction_ready:
292
+ raise gr.Error("Henüz gerçek tahmin tamamlanmadı. Lütfen bekleyin.")
293
+
294
  if encrypted_output is None:
295
+ raise gr.Error("Tahmin sonucu bulunamadı.")
296
+
297
  predictions = []
298
  for enc in encrypted_output:
299
  pred = client.deserialize_decrypt_dequantize(enc)