Poe Dator commited on
Commit
239f32e
1 Parent(s): b7fbb48

dilbert img

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -6,6 +6,7 @@ from time import time
6
  import matplotlib.pyplot as plt
7
  # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
8
  device = 'cpu'
 
9
 
10
  # dict for decoding / enclding labels
11
  labels = {'cs.NE': 0, 'cs.CL': 1, 'cs.AI': 2, 'stat.ML': 3, 'cs.CV': 4, 'cs.LG': 5}
@@ -58,17 +59,19 @@ def inference(txt, mode=None):
58
 
59
  model = build_model()
60
 
61
- st.markdown("### Privet, mir!")
62
- st.markdown("<img width=200px src='https://i.pinimg.com/736x/11/33/19/113319f0ffe91f4bb0f468914b9916da.jpg'>", unsafe_allow_html=True)
 
 
63
 
64
  text = st.text_area("ENTER TEXT HERE")
 
65
  start_time = time()
66
- st.markdown("INFERENCE STARTS ...")
67
-
68
 
69
  res = inference(text, mode=None)
70
  res.sort(key = lambda x : - x[1])
71
- st.markdown("<b>INFERENCE RESULT:</b>")
 
72
  for lbl, score in res:
73
  if score >=1:
74
  st.markdown(f"[ {lbl:<7}] {labels_decoder[lbl]:<35} {score:.1f}%")
 
6
  import matplotlib.pyplot as plt
7
  # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
8
  device = 'cpu'
9
+ from PIL import Image
10
 
11
  # dict for decoding / enclding labels
12
  labels = {'cs.NE': 0, 'cs.CL': 1, 'cs.AI': 2, 'stat.ML': 3, 'cs.CV': 4, 'cs.LG': 5}
 
59
 
60
  model = build_model()
61
 
62
+ st.markdown("###Predict topic by abstract.")
63
+ image = Image.open('dilbert_big_data.jpg')
64
+ st.image(image)
65
+ # st.markdown("<img width=200px src='https://i.pinimg.com/736x/11/33/19/113319f0ffe91f4bb0f468914b9916da.jpg'>", unsafe_allow_html=True)
66
 
67
  text = st.text_area("ENTER TEXT HERE")
68
+
69
  start_time = time()
 
 
70
 
71
  res = inference(text, mode=None)
72
  res.sort(key = lambda x : - x[1])
73
+
74
+ st.markdown("INFERENCE RESULT")
75
  for lbl, score in res:
76
  if score >=1:
77
  st.markdown(f"[ {lbl:<7}] {labels_decoder[lbl]:<35} {score:.1f}%")