SatAT commited on
Commit
1409048
·
1 Parent(s): 2128722

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -1
app.py CHANGED
@@ -28,9 +28,54 @@ logits = model(input_ids, attention_mask)[0]
28
  probs = torch.softmax(logits, dim=1)
29
 
30
  predicted_category = torch.argmax(probs).item()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  # from transformers import pipeline
32
  # pipe = pipeline("ner", "Davlan/distilbert-base-multilingual-cased-ner-hrl")
33
- raw_predictions = predicted_category#le.inverse_transform(prediction)#pipe(text)
34
  # тут уже знакомый вам код с huggingface.transformers -- его можно заменить на что угодно от fairseq до catboost
35
 
36
  st.markdown(f"{raw_predictions}")
 
28
  probs = torch.softmax(logits, dim=1)
29
 
30
  predicted_category = torch.argmax(probs).item()
31
+
32
+ tags_names = ['acc-phys',
33
+ 'adap-org',
34
+ "adap-org'",
35
+ 'alg-geom',
36
+ 'astro-ph',
37
+ "astro-ph'",
38
+ 'chao-dyn',
39
+ 'chem-ph',
40
+ 'cmp-lg',
41
+ "cmp-lg'",
42
+ 'comp-gas',
43
+ 'cond-mat',
44
+ "cond-mat'",
45
+ 'cs',
46
+ 'dg-ga',
47
+ 'econ',
48
+ 'eess',
49
+ 'funct-an',
50
+ 'gr-qc',
51
+ "gr-qc'",
52
+ 'hep-ex',
53
+ "hep-ex'",
54
+ 'hep-lat',
55
+ "hep-lat'",
56
+ 'hep-ph',
57
+ "hep-ph'",
58
+ 'hep-th',
59
+ "hep-th'",
60
+ 'math',
61
+ 'math-ph',
62
+ 'mtrl-th',
63
+ 'nlin',
64
+ 'nucl-ex',
65
+ 'nucl-th',
66
+ "nucl-th'",
67
+ 'patt-sol',
68
+ 'physics',
69
+ 'q-alg',
70
+ 'q-bio',
71
+ 'q-fin',
72
+ 'quant-ph',
73
+ "quant-ph'",
74
+ 'solv-int',
75
+ 'stat']
76
  # from transformers import pipeline
77
  # pipe = pipeline("ner", "Davlan/distilbert-base-multilingual-cased-ner-hrl")
78
+ raw_predictions = tags_names[predicted_category]#le.inverse_transform(prediction)#pipe(text)
79
  # тут уже знакомый вам код с huggingface.transformers -- его можно заменить на что угодно от fairseq до catboost
80
 
81
  st.markdown(f"{raw_predictions}")