File size: 1,284 Bytes
ddec2c4
 
 
f1ad590
ddec2c4
 
 
 
 
 
 
f1ad590
ddec2c4
 
 
 
f1ad590
 
 
 
 
 
 
ddec2c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
# --- Imports libs ---
import gradio as gr
import pandas as pd
import configparser


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


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


# --- Tool config ---
cfg = configparser.ConfigParser()
cfg.read('tool.cfg')

LANGUAGE            = cfg['INTERFACE']['language']
LANGUAGE_MODEL      = cfg['LMODEL']['language_model']
AVAILABLE_LOGS      = cfg['LOGS'].getboolean('available_logs')



# --- 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)