MurDanya commited on
Commit
af315b6
·
verified ·
1 Parent(s): 6a8a4c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
  from huggingface_hub import hf_hub_download
4
  import torch
5
  import numpy as np
 
6
  import json
7
 
8
  @st.cache_resource
@@ -52,6 +53,15 @@ if st.button("Classify"):
52
 
53
  top_labels = get_top95(id2label, probs)
54
 
55
- st.markdown("Top 95% topics:")
56
  for label, prob in top_labels:
57
- st.markdown(f"- **{categories[label]} ({label})**: {prob * 100:.1f}%")
 
 
 
 
 
 
 
 
 
 
3
  from huggingface_hub import hf_hub_download
4
  import torch
5
  import numpy as np
6
+ import pandas as pd
7
  import json
8
 
9
  @st.cache_resource
 
53
 
54
  top_labels = get_top95(id2label, probs)
55
 
56
+ results = []
57
  for label, prob in top_labels:
58
+ results.append({
59
+ "Category": categories[label],
60
+ "ID": label,
61
+ "Confidence": f"{prob * 100:.1f} %"
62
+ })
63
+
64
+ df = pd.DataFrame(results)
65
+
66
+ st.markdown("### 🧠 Top 95% Predicted Topics")
67
+ st.dataframe(df, use_container_width=True)