Create app.py
Browse filesSimply returns labels and emotion scores
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
|
7 |
+
def analyze(poem):
|
8 |
+
classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", return_all_scores=True)
|
9 |
+
return classifier(poem)
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
fn=analyze,
|
13 |
+
inputs= 'text',
|
14 |
+
outputs="text",
|
15 |
+
allow_flagging=False,).launch();
|