hieu3636 commited on
Commit
1a9c9bc
·
verified ·
1 Parent(s): 2bfda93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -1,20 +1,11 @@
1
-
2
  import gradio as gr
3
  import numpy as np
4
  import joblib
5
  import tensorflow as tf
6
- from huggingface_hub import hf_hub_download
7
 
8
-
9
- REPO_ID = "malware-USTH/mlp-malware"
10
-
11
- # Download model & scaler from Hugging Face Hub
12
- model_dir = hf_hub_download(REPO_ID, "mlp_model.keras", repo_type="model")
13
- scaler_path = hf_hub_download(REPO_ID, "scaler.pkl")
14
-
15
- # Load
16
- model = tf.keras.models.load_model(model_dir)
17
- scaler = joblib.load(scaler_path)
18
 
19
  N_FEATURES = model.input_shape[1]
20
 
@@ -33,5 +24,5 @@ inputs = [gr.Number(label=f"Feature {i+1}") for i in range(N_FEATURES)]
33
  gr.Interface(
34
  fn=predict,
35
  inputs=inputs,
36
- outputs="json",
37
  ).launch()
 
 
1
  import gradio as gr
2
  import numpy as np
3
  import joblib
4
  import tensorflow as tf
 
5
 
6
+ # Load local files
7
+ model = tf.keras.models.load_model("mlp_model.keras")
8
+ scaler = joblib.load("scaler.pkl")
 
 
 
 
 
 
 
9
 
10
  N_FEATURES = model.input_shape[1]
11
 
 
24
  gr.Interface(
25
  fn=predict,
26
  inputs=inputs,
27
+ outputs="json"
28
  ).launch()