Commit 0b423535 authored by Jiang, Genze's avatar Jiang, Genze
Browse files

Update app_utils.py

parent 623f1b68
# -*- coding: UTF-8 -*-
from mmf.models.mmbt import MMBT
from mmf.models.fusions import LateFusion
from mmf.models.vilbert import ViLBERT
......@@ -12,6 +10,7 @@ import json
import re
from mmxai.onnx.onnxModel import ONNXInterface
class InputError(Exception):
def __init__(self, msg):
self.msg = msg
......@@ -51,8 +50,8 @@ def prepare_explanation(
return model, label_to_explain, label, conf
# get model output in binary classification format with 2 labels """
def model_output(cls_label, cls_confidence):
""" get model output in binary classification format with 2 labels """
out = np.zeros(2)
out[cls_label] = cls_confidence
out[1 - cls_label] = 1 - cls_confidence
......@@ -172,17 +171,6 @@ def text_visualisation(exp, pred_res, save_path):
def read_examples_metadata(path="static/examples/metadata.json"):
""" Function/Class description
Args:
param1:
Returns:
a dictionary
Raises:
KeyError: An example
"""
with open(path) as f:
s = json.load(f)
return s
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment