Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
|
4 |
-
|
5 |
-
custom_theme = gr.Interface.Theme(
|
6 |
-
background="linear-gradient(45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB)",
|
7 |
-
textColor="white",
|
8 |
-
titleColor="white",
|
9 |
-
font="Arial",
|
10 |
-
titleFont="Arial",
|
11 |
-
padding="20px",
|
12 |
-
inputBorderWidth=2,
|
13 |
-
inputBorderColor="#FFFFFF",
|
14 |
-
outputBorderWidth=2,
|
15 |
-
outputBorderColor="#FFFFFF",
|
16 |
-
)
|
17 |
|
18 |
# Model in Hugging Hub
|
19 |
tokenizer = AutoTokenizer.from_pretrained("Andresmfs/st5s-es-inclusivo")
|
@@ -28,12 +16,19 @@ def make_neutral(phrase):
|
|
28 |
|
29 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
outputs="text",
|
35 |
-
title="Gender-Neutralizer",
|
36 |
-
theme = custom_theme,
|
37 |
-
description="Enter a gendered phrase and get it converted into neutral form."
|
38 |
)
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
|
4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Model in Hugging Hub
|
7 |
tokenizer = AutoTokenizer.from_pretrained("Andresmfs/st5s-es-inclusivo")
|
|
|
16 |
|
17 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
18 |
|
19 |
+
theme = gr.themes.Default(primary_hue="blue").set(
|
20 |
+
loader_color="#FF0000",
|
21 |
+
slider_color="#FF0000",
|
|
|
|
|
|
|
|
|
22 |
)
|
23 |
+
|
24 |
+
with gr.Blocks(theme=theme) as demo:
|
25 |
+
|
26 |
+
iface = gr.Interface(
|
27 |
+
fn=make_neutral,
|
28 |
+
inputs="text",
|
29 |
+
outputs="text",
|
30 |
+
title="Gender-Neutralizer",
|
31 |
+
theme = custom_theme,
|
32 |
+
description="Enter a gendered phrase and get it converted into neutral form."
|
33 |
+
)
|
34 |
+
iface.launch()
|