bharat-raghunathan commited on
Commit
e302782
1 Parent(s): 55bc875

Update app v0.99

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  import torch
4
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
 
5
 
6
  def lyrics_categories(input_text):
7
  spotify_model = "spotify/autonlp-huggingface-demo-song-lyrics-18923587"
@@ -16,8 +17,15 @@ def lyrics_categories(input_text):
16
  clean_outputs = {labels[idx]:str(predictions[idx]) for idx in index_sorted}
17
  print(clean_outputs)
18
  return clean_outputs
 
 
19
 
20
  iface = gr.Interface(fn=lyrics_categories,
21
  inputs=gr.inputs.Textbox(lines=20, placeholder="Enter song lyrics here...", label="Song Lyrics"),
22
- outputs=gr.outputs.Label(num_top_classes=5, label="Lyrics Categories"))
 
 
 
 
 
23
  iface.launch()
 
2
  import numpy as np
3
  import torch
4
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
5
+ from examples import yellow, stairway, numb, puppets, firework
6
 
7
  def lyrics_categories(input_text):
8
  spotify_model = "spotify/autonlp-huggingface-demo-song-lyrics-18923587"
 
17
  clean_outputs = {labels[idx]:str(predictions[idx]) for idx in index_sorted}
18
  print(clean_outputs)
19
  return clean_outputs
20
+
21
+ description = "With lyrics, find the top 5 genres this song belongs to! (Powered by Spotify)"
22
 
23
  iface = gr.Interface(fn=lyrics_categories,
24
  inputs=gr.inputs.Textbox(lines=20, placeholder="Enter song lyrics here...", label="Song Lyrics"),
25
+ outputs=gr.outputs.Label(num_top_classes=5,
26
+ examples=[stairway, numb, puppets, firework, yellow],
27
+ article=desc,
28
+ title="Song Lyrics Classifier",
29
+ label="Lyrics Categories")
30
+ )
31
  iface.launch()