File size: 1,250 Bytes
b546526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44f418e
b546526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# --- Imports libs ---
import gradio as gr
import pandas as pd


# --- Imports modules ---
from modules.module_languageModel import LanguageModel


# --- Imports interfaces ---
from interfaces.interface_sesgoEnFrases import interface as interface_sesgoEnFrases
from interfaces.interface_crowsPairs import interface as interface_crowsPairs


# --- Tool config ---
LANGUAGE_MODEL  = "bert-base-multilingual-uncased"
LANGUAGE        = "english"                                     # [english]
AVAILABLE_LOGS  = True                                          # [True | False]


# --- Init classes ---
bert_lm = LanguageModel(
    model_name=LANGUAGE_MODEL
)

# --- Init Vars ---
labels = pd.read_json(f"language/{LANGUAGE}.json")["app"]


# --- Init App ---
INTERFACE_LIST = [
    interface_sesgoEnFrases(
        language_model=bert_lm,
        available_logs=AVAILABLE_LOGS,
        lang=LANGUAGE),
    interface_crowsPairs(
        language_model=bert_lm,
        available_logs=AVAILABLE_LOGS,
        lang=LANGUAGE),
]

TAB_NAMES = [
    labels["phraseExplorer"],
    labels["crowsPairsExplorer"]
]

iface = gr.TabbedInterface(
    interface_list=INTERFACE_LIST, 
    tab_names=TAB_NAMES
)

iface.queue(concurrency_count=8)
iface.launch(debug=False)