File size: 1,630 Bytes
40d1f52
 
 
 
 
 
 
 
 
 
5a493cf
 
 
40d1f52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a493cf
 
40d1f52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import gradio as gr
import os

path_to_L_model = str(os.environ['path_to_L_model'])
path_to_S_model = str(os.environ['path_to_S_model'])
read_token      = str(os.environ['read_token'])

title = "DSA II"

description_main = """
A set of models to perform sentiment analysis. Choose between Large-Multilingual or Small-En-only. 

Select one of the two pages to start querying one of the two models.
"""

description_L = """
XLM-R tuned model, EN-tuned, pre-trained with 94 languages available (see original model [card](https://huggingface.co/xlm-roberta-large) to see which are available)
"""

description_S = """
A tuned BERT-base-cased model.
"""

examples = [
    ["I was followed by the blue monster but was not scared. I was calm and relaxed."],
    ["Ero seguito dal mostro blu, ma non ero spaventato. Ero calmo e rilassato."],
    ["Śledził mnie niebieski potwór, ale się nie bałem. Byłem spokojny i zrelaksowany."],
]

interface_words = gr.Interface(
            fn=None,
            inputs=None, 
            outputs=None,
            description=description_main,
)

interface_model_L = gr.Interface.load(
            name=path_to_L_model,
            description=description_L,
            examples=examples,
            title=title,
            api_key=read_token,
)

interface_model_S = gr.Interface.load(
            name=path_to_S_model,
            description=description_S,
            examples=examples[0],
            title=title,
            api_key=read_token,
)

gr.TabbedInterface(
    [interface_words, interface_model_L, interface_model_S], 
    ["Intro", "Large Multilingual", "Base En"]
).launch()