King-8 commited on
Commit
c5ebddc
·
verified ·
1 Parent(s): e7d2b7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -30,12 +30,28 @@ def classify_confidence(text):
30
  label_text = label_map[label]
31
  color = "green" if label == "LABEL_0" else "red"
32
 
33
- return f"<b>Prediction:</b> <span style='color: {color}; font-weight: bold'>{label_text}</span> ({score}%)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  iface = gr.Interface(
36
  fn=classify_confidence,
37
  inputs=gr.Textbox(lines=3, placeholder="Enter a statement..."),
38
- outputs="html", # changed from "text" to "html"
39
  title="🌟 Confidence Classifier",
40
  description="""
41
  Enter a statement, and this model will predict whether it shows confidence or not.
@@ -45,4 +61,4 @@ Enter a statement, and this model will predict whether it shows confidence or no
45
  """,
46
  )
47
 
48
- iface.launch()
 
30
  label_text = label_map[label]
31
  color = "green" if label == "LABEL_0" else "red"
32
 
33
+ # Return styled HTML with a box and larger text
34
+ return f"""
35
+ <div style="
36
+ border: 2px solid {color};
37
+ border-radius: 8px;
38
+ padding: 15px;
39
+ max-width: 400px;
40
+ margin: 10px auto;
41
+ background-color: #f9f9f9;
42
+ font-size: 24px;
43
+ font-weight: bold;
44
+ text-align: center;
45
+ color: {color};
46
+ ">
47
+ Prediction: {label_text} ({score}%)
48
+ </div>
49
+ """
50
 
51
  iface = gr.Interface(
52
  fn=classify_confidence,
53
  inputs=gr.Textbox(lines=3, placeholder="Enter a statement..."),
54
+ outputs="html",
55
  title="🌟 Confidence Classifier",
56
  description="""
57
  Enter a statement, and this model will predict whether it shows confidence or not.
 
61
  """,
62
  )
63
 
64
+ iface.launch()