buraktrk commited on
Commit
714e0f4
·
verified ·
1 Parent(s): 0f55337

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -203,18 +203,19 @@ def encrypt_excel(file):
203
  if file is None:
204
  raise gr.Error("Lütfen önce bir Excel dosyası yükleyin.")
205
 
206
- global encrypted_input, encrypted_output, fhe_prediction_ready
207
 
208
  if client is None:
209
  raise gr.Error("Lütfen önce 'Anahtar Oluştur'a tıklayın.")
210
 
211
- # Yeni yükleme geldiğinde eski tahminleri sıfırla
212
  encrypted_output = None
213
  fhe_prediction_ready = False
 
214
 
215
  df = pd.read_excel(file.name, header=None).set_index(0).T.reset_index(drop=True)
216
 
217
- # Temizlik işlemleri
218
  df.columns = df.columns.str.strip()
219
  df = df.loc[:, ~df.columns.duplicated()]
220
  df.rename(columns={"Desc": "Periyot"}, inplace=True)
@@ -228,7 +229,7 @@ def encrypt_excel(file):
228
 
229
  scaled = scaler_sel.transform(X_input)
230
 
231
- # Her satırı ayrı ayrı şifrele
232
  encrypted_list = []
233
  for row in scaled:
234
  row = row.reshape(1, -1)
@@ -243,8 +244,12 @@ def encrypt_excel(file):
243
 
244
 
245
 
 
246
  def run_fhe():
247
  global server, encrypted_output, fhe_prediction_ready
 
 
 
248
  if encrypted_input is None:
249
  raise gr.Error("Veri şifrelenmemiş.")
250
 
 
203
  if file is None:
204
  raise gr.Error("Lütfen önce bir Excel dosyası yükleyin.")
205
 
206
+ global encrypted_input, encrypted_output, fhe_prediction_ready, simulate_prediction
207
 
208
  if client is None:
209
  raise gr.Error("Lütfen önce 'Anahtar Oluştur'a tıklayın.")
210
 
211
+ # 🧹 Yeni yükleme geldiğinde önceki tahminleri sıfırla
212
  encrypted_output = None
213
  fhe_prediction_ready = False
214
+ simulate_prediction = []
215
 
216
  df = pd.read_excel(file.name, header=None).set_index(0).T.reset_index(drop=True)
217
 
218
+ # 🧼 Temizlik işlemleri
219
  df.columns = df.columns.str.strip()
220
  df = df.loc[:, ~df.columns.duplicated()]
221
  df.rename(columns={"Desc": "Periyot"}, inplace=True)
 
229
 
230
  scaled = scaler_sel.transform(X_input)
231
 
232
+ # 🔐 Her satırı ayrı ayrı şifrele
233
  encrypted_list = []
234
  for row in scaled:
235
  row = row.reshape(1, -1)
 
244
 
245
 
246
 
247
+
248
  def run_fhe():
249
  global server, encrypted_output, fhe_prediction_ready
250
+ if client is None:
251
+ raise gr.Error("Lütfen önce 'Anahtar Oluştur'a tıklayın.")
252
+
253
  if encrypted_input is None:
254
  raise gr.Error("Veri şifrelenmemiş.")
255