John Graham Reynolds
more test fixes
6fdccff
raw
history blame
1.89 kB
from fixed_f1 import FixedF1
from fixed_precision import FixedPrecision
from fixed_recall import FixedRecall
import gradio as gr
title = "'Combine' multiple metrics with this πŸ€— Evaluate πŸͺ² Fix!"
description = """<p style='text-align: center'>
As I introduce myself to the entirety of the πŸ€— ecosystem, I've put together this space to show off a workaround for a current πŸͺ² in the πŸ€— Evaluate library. \n
Check out the original, longstanding issue [here](https://github.com/huggingface/evaluate/issues/234). This details how it is currently impossible to \
'evaluate.combine()' multiple metrics related to multilabel text classification. Particularly, one cannot 'combine()' the f1, precision, and recall scores for \
evaluation. I encountered this issue specifically while training [RoBERTa-base-DReiFT](https://huggingface.co/MarioBarbeque/RoBERTa-base-DReiFT) for multilabel \
text classification of 805 labeled medical conditions based on drug reviews for treatment received for the same underlying conditio. Use the space below for \
a preview of the workaround! \n
Try to use \t to write some code? \t or how does that work? </p>
"""
article = "<p style='text-align: center'>Check out the [original repo](https://github.com/johngrahamreynolds/FixedMetricsForHF) housing this code, and a quickly \
trained [multilabel text classicifcation model](https://github.com/johngrahamreynolds/RoBERTa-base-DReiFT/tree/main) that makes use of it during evaluation.</p>"
def show_off(input):
f1 = FixedF1()
precision = FixedPrecision()
recall = FixedRecall()
return "Checking this out! Here's what you put in: " + f"""{input} """
gr.Interface(
fn=show_off,
inputs="textbox",
outputs="text",
title=title,
description=description,
article=article,
examples=[["What are you doing?"], ["Where should we time travel to?"]],
).launch()