Spaces:
Sleeping
Sleeping
lorenzoscottb
commited on
Commit
β’
84f8a6c
1
Parent(s):
74ad74c
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from graph_utils import *
|
|
|
4 |
|
5 |
languages = pd.read_csv("model_lang.csv", names=["Lang_acr"])
|
6 |
|
@@ -68,14 +69,15 @@ examples_re = [
|
|
68 |
]
|
69 |
|
70 |
interface_words = gr.Interface(
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
77 |
)
|
78 |
-
|
79 |
# interface_model_L = gr.Interface(
|
80 |
# description=description_L,
|
81 |
# examples=examples,
|
@@ -83,12 +85,18 @@ interface_words = gr.Interface(
|
|
83 |
# )
|
84 |
# interface_model_L.load("models/DReAMy-lib/xlm-roberta-large-DreamBank-emotion-presence")
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
-
|
88 |
-
# "models/DReAMy-lib/bert-base-cased-DreamBank-emotion-presence",
|
89 |
-
# examples=examples[0],
|
90 |
-
# title="SA Base English-Only",
|
91 |
-
# )
|
92 |
|
93 |
# interface_model_G = gr.Interface.load(
|
94 |
# "models/DReAMy-lib/t5-base-DreamBank-Generation-Emot-Char",
|
@@ -117,6 +125,6 @@ interface_model_RE = gr.Interface(
|
|
117 |
# )
|
118 |
|
119 |
gr.TabbedInterface(
|
120 |
-
[interface_words, interface_model_RE],
|
121 |
-
["Main", "RE"],
|
122 |
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from graph_utils import *
|
4 |
+
from transformers import pipeline
|
5 |
|
6 |
languages = pd.read_csv("model_lang.csv", names=["Lang_acr"])
|
7 |
|
|
|
69 |
]
|
70 |
|
71 |
interface_words = gr.Interface(
|
72 |
+
fn=check_lang,
|
73 |
+
inputs="text",
|
74 |
+
outputs="text",
|
75 |
+
title=title,
|
76 |
+
description=description_main,
|
77 |
+
examples=[["en"], ["it"], ["pl"]],
|
78 |
+
cache_examples=True,
|
79 |
)
|
80 |
+
|
81 |
# interface_model_L = gr.Interface(
|
82 |
# description=description_L,
|
83 |
# examples=examples,
|
|
|
85 |
# )
|
86 |
# interface_model_L.load("models/DReAMy-lib/xlm-roberta-large-DreamBank-emotion-presence")
|
87 |
|
88 |
+
pipe_S = pipeline("text2text-generation", model="DReAMy-lib/t5-base-DreamBank-Generation-Emot-Char")
|
89 |
+
def predict(text):
|
90 |
+
return pipe_S(text)
|
91 |
+
interface_model_S = gr.Interface(
|
92 |
+
fn=pipe_S,
|
93 |
+
inputs='text',
|
94 |
+
outputs='labels',
|
95 |
+
examples=examples[0],
|
96 |
+
title="SA Base English-Only",
|
97 |
+
cache_examples=True,
|
98 |
|
99 |
+
)
|
|
|
|
|
|
|
|
|
100 |
|
101 |
# interface_model_G = gr.Interface.load(
|
102 |
# "models/DReAMy-lib/t5-base-DreamBank-Generation-Emot-Char",
|
|
|
125 |
# )
|
126 |
|
127 |
gr.TabbedInterface(
|
128 |
+
[interface_words, interface_model_S, interface_model_RE],
|
129 |
+
["Main", "SA English", "RE"],
|
130 |
).launch()
|