File size: 1,235 Bytes
a779273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# --- Imports libs ---
import gradio as gr
import pandas as pd


# --- Imports modules ---
from modules.model_embbeding import Embedding

# --- Imports interfaces ---
from interfaces.interface_WordExplorer import interface as wordExplorer_interface
from interfaces.interface_BiasWordExplorer import interface as biasWordExplorer_interface

# --- Tool config ---
AVAILABLE_LOGS      = True                          # [True     | False]
LANGUAGE            = "spanish"                     # [spanish  | english]
EMBEDDING_SUBSET    = "fasttext"                    # [fasttext | mini]

# --- Init classes ---
embedding = Embedding(
    subset_name=EMBEDDING_SUBSET
)
labels = pd.read_json(f"language/{LANGUAGE}.json")["app"]

# --- Main App ---
INTERFACE_LIST = [
    biasWordExplorer_interface(
        embedding=embedding,
        available_logs=AVAILABLE_LOGS,
        lang=LANGUAGE),
    wordExplorer_interface(
        embedding=embedding,
        available_logs=AVAILABLE_LOGS,
        lang=LANGUAGE),
]

TAB_NAMES = [
    labels["biasWordExplorer"],
    labels["wordExplorer"],
]

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

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