Spaces:
Sleeping
Sleeping
update interface
Browse files
app.py
CHANGED
@@ -57,22 +57,19 @@ def classify_question(text):
|
|
57 |
|
58 |
# Create a list of probabilities for each model
|
59 |
probs = {
|
60 |
-
"
|
61 |
-
"Model
|
62 |
-
"
|
63 |
-
"Model 4 Probability": float(pred4),
|
64 |
-
"Average Probability": float(avg_pred),
|
65 |
-
"Sequence": seq
|
66 |
}
|
67 |
|
68 |
return label, probs
|
69 |
|
70 |
# Example questions
|
71 |
-
|
72 |
-
"
|
73 |
-
"
|
74 |
-
"Why
|
75 |
-
"
|
76 |
]
|
77 |
|
78 |
# Gradio Interface
|
@@ -80,13 +77,13 @@ interface = gr.Interface(
|
|
80 |
fn=classify_question,
|
81 |
inputs=[
|
82 |
gr.Textbox(lines=2, placeholder="Enter your question here..."),
|
83 |
-
# gr.Dropdown(example_questions, label="Select an example question:")
|
84 |
],
|
85 |
outputs=[
|
86 |
"text", # Output for label
|
87 |
"json" # Output for probabilities
|
88 |
],
|
89 |
title="Quora Insincere Questions Classifier",
|
|
|
90 |
description="Enter your question to classify it as sincere or insincere. Select an example question from the dropdown."
|
91 |
)
|
92 |
|
|
|
57 |
|
58 |
# Create a list of probabilities for each model
|
59 |
probs = {
|
60 |
+
"Probability": float(avg_pred),
|
61 |
+
"Model Probabilities": {"Model 1": float(pred1), "Model 2": float(pred2), "Model 3": float(pred3), "Model 4": float(pred4), "visible": False},
|
62 |
+
"Sequence": {"value": seq, "visible": False}
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
return label, probs
|
66 |
|
67 |
# Example questions
|
68 |
+
examples = [
|
69 |
+
"How do you train a pigeon to send messages?",
|
70 |
+
"Is USA a shithole country owing to a shithole president?",
|
71 |
+
"Why is Indian educationa total bullshit?",
|
72 |
+
"Which person has given the least f**ks and still turned out successful?"
|
73 |
]
|
74 |
|
75 |
# Gradio Interface
|
|
|
77 |
fn=classify_question,
|
78 |
inputs=[
|
79 |
gr.Textbox(lines=2, placeholder="Enter your question here..."),
|
|
|
80 |
],
|
81 |
outputs=[
|
82 |
"text", # Output for label
|
83 |
"json" # Output for probabilities
|
84 |
],
|
85 |
title="Quora Insincere Questions Classifier",
|
86 |
+
examples=examples,
|
87 |
description="Enter your question to classify it as sincere or insincere. Select an example question from the dropdown."
|
88 |
)
|
89 |
|