|
from transformers import pipeline |
|
import gradio as gr |
|
|
|
|
|
pipe = pipeline("text-classification", model="AliArshad/Severity_Predictor") |
|
from transformers import pipeline |
|
import gradio as gr |
|
|
|
|
|
pipe = pipeline("text-classification", model="AliArshad/Severity_Predictor") |
|
|
|
|
|
def predict_severity(text): |
|
|
|
prediction = pipe(text) |
|
|
|
|
|
label = prediction[0]['label'] |
|
confidence = prediction[0]['score'] |
|
severity = "Severe" if label == "LABEL_1" else "Non-Severe" |
|
|
|
|
|
return severity, confidence |
|
|
|
|
|
iface = gr.Interface( |
|
fn=predict_severity, |
|
inputs=gr.Textbox(lines=2, placeholder="Please Enter Bug Report Summary"), |
|
outputs=[ |
|
gr.Textbox(label="Prediction"), |
|
gr.Number(label="Confidence", precision=2) |
|
], |
|
title="GPT-2 Based Severity Prediction" |
|
examples=[ |
|
["Can't open multiple bookmarks at once from the bookmarks sidebar using the context menu"], |
|
["Minor enhancements to make-source-package.sh"] |
|
] |
|
) |
|
|
|
|
|
iface.launch() |
|
|