pgurazada1 commited on
Commit
a94cbc1
·
verified ·
1 Parent(s): fb54360

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -19,14 +19,12 @@ classifier = pipeline(
19
 
20
  def predict(user_input: str):
21
 
22
- prediction = json.loads(classifier(user_input))[0]
23
- label = prediction['label']
24
- probability = prediction['score']
25
 
26
- return f"The input is like to be a {label} with probability: {probability}"
27
 
28
 
29
- textbox = gr.Textbox(placeholder="Enter user input presented for injection attack classification", lines=12)
30
 
31
  interface = gr.Interface(
32
  inputs=textbox, fn=predict, outputs="text",
 
19
 
20
  def predict(user_input: str):
21
 
22
+ prediction = classifier(user_input)[0]
 
 
23
 
24
+ return f"This is likely to be an {prediction['label']} with a probability of {prediction['score']}"
25
 
26
 
27
+ textbox = gr.Textbox(placeholder="Enter user input for injection attack classification", lines=12)
28
 
29
  interface = gr.Interface(
30
  inputs=textbox, fn=predict, outputs="text",