edia_we_es / app.py
LMartinezEXEX's picture
Using data_loader to load vector files instead of json.
785b2ef
raw
history blame
1.29 kB
# --- 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]
EMBEDDINGS_PATH = "data/fasttext-sbwc.100k.vec"
# --- Init classes ---
embedding = Embedding(
path=EMBEDDINGS_PATH,
binary=EMBEDDINGS_PATH.endswith('.bin'),
limit=None,
randomizedPCA=False
)
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)