ankush-003 commited on
Commit
b280351
1 Parent(s): 282d4bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
12
  model = TFAutoModelForSequenceClassification.from_pretrained("ankush-003/nosqli_identifier")
13
 
14
  def predict(username, pwd, label, payload_text = None):
15
- if(payload_text is None):
16
  payload["username"] = username
17
  payload["password"] = pwd
18
  payload_text = json.dumps(payload)
@@ -22,7 +22,7 @@ def predict(username, pwd, label, payload_text = None):
22
  predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
23
  # print(model.config.id2label[predicted_class_id])
24
 
25
- return model.config.id2label[predicted_class_id], payload_text
26
 
27
  input_elements = [gr.Textbox(label="Enter Username"), gr.Textbox(label="Enter Password"), gr.Dropdown(["Malitious", "Benign"], label="Expected", info="Enter expected value"),
28
  gr.Textbox(label="Enter Payload", info="Optional if username and password entered already")]
 
12
  model = TFAutoModelForSequenceClassification.from_pretrained("ankush-003/nosqli_identifier")
13
 
14
  def predict(username, pwd, label, payload_text = None):
15
+ if(payload_text is None or payload_text = ""):
16
  payload["username"] = username
17
  payload["password"] = pwd
18
  payload_text = json.dumps(payload)
 
22
  predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
23
  # print(model.config.id2label[predicted_class_id])
24
 
25
+ return payload_text, model.config.id2label[predicted_class_id]
26
 
27
  input_elements = [gr.Textbox(label="Enter Username"), gr.Textbox(label="Enter Password"), gr.Dropdown(["Malitious", "Benign"], label="Expected", info="Enter expected value"),
28
  gr.Textbox(label="Enter Payload", info="Optional if username and password entered already")]