non2013 commited on
Commit
f227fd1
·
1 Parent(s): 417c147

update interface

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -57,22 +57,19 @@ def classify_question(text):
57
 
58
  # Create a list of probabilities for each model
59
  probs = {
60
- "Model 1 Probability": float(pred1),
61
- "Model 2 Probability": float(pred2),
62
- "Model 3 Probability": float(pred3),
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
- example_questions = [
72
- "Is this the best place to get information?",
73
- "I need help with my homework.",
74
- "Why do people ask such stupid questions?",
75
- "Can you tell me the answer to life?"
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