adorkin commited on
Commit
9b3da76
1 Parent(s): 46623a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -23,11 +23,7 @@ def get_top_emojis(text, top_n=TOP_N):
23
  preds = model(**inputs).logits
24
  scores = torch.nn.functional.softmax(preds, dim=-1).detach().numpy()
25
  ranking = np.argsort(scores)
26
- print(ranking)
27
  ranking = ranking.squeeze()[::-1][:top_n]
28
- print(scores)
29
- print(ranking)
30
- print(model.config.id2label)
31
  emojis = [model.config.id2label[i] for i in ranking]
32
  return emojis
33
 
@@ -37,14 +33,17 @@ gradio_ui = gr.Interface(
37
  title="Predicting emojis for tweets",
38
  description="Enter a tweet to predict emojis",
39
  inputs=[
40
- gr.inputs.Textbox(lines=5, label="Paste a tweet here"),
41
  ],
42
  outputs=[
43
- gr.outputs.Textbox(label=f"Label")
44
  ],
45
  examples=[
46
  ["Awesome!"], ["Круто!"], ["lol"]
47
  ],
 
 
 
48
  )
49
 
50
  gradio_ui.launch(debug=True)
 
23
  preds = model(**inputs).logits
24
  scores = torch.nn.functional.softmax(preds, dim=-1).detach().numpy()
25
  ranking = np.argsort(scores)
 
26
  ranking = ranking.squeeze()[::-1][:top_n]
 
 
 
27
  emojis = [model.config.id2label[i] for i in ranking]
28
  return emojis
29
 
 
33
  title="Predicting emojis for tweets",
34
  description="Enter a tweet to predict emojis",
35
  inputs=[
36
+ gr.inputs.Textbox(lines=3, label="Paste a tweet here"),
37
  ],
38
  outputs=[
39
+ gr.outputs.Textbox(label=f"Predicted emojis")
40
  ],
41
  examples=[
42
  ["Awesome!"], ["Круто!"], ["lol"]
43
  ],
44
+ enable_queue=True,
45
+ allow_screenshot=False,
46
+ allow_flagging=False
47
  )
48
 
49
  gradio_ui.launch(debug=True)