devngho's picture
Update app.py
977b742 verified
raw
history blame
997 Bytes
from transformers import pipeline
import gradio as gr
models = {
'devngho/ko_edu_classifier_v2_nlpai-lab_KoE5': pipeline("text-classification", model="devngho/ko_edu_classifier_v2_nlpai-lab_KoE5"),
'devngho/ko_edu_classifier_v2_lemon-mint_LaBSE-EnKo-Nano-Preview-v0.3': pipeline("text-classification", model="devngho/ko_edu_classifier_v2_lemon-mint_LaBSE-EnKo-Nano-Preview-v0.3"),
'devngho/ko_edu_classifier_v2_LaBSE': pipeline("text-classification", model="devngho/ko_edu_classifier_v2_LaBSE")
}
import gradio as gr
def evaluate_model(input_text):
return [model(input_text) for model in models.values()]
# Gradio interface
with gr.Blocks() as demo:
input_text = gr.Textbox(label="Input Text")
submit_button = gr.Button("Evaluate")
output_scores = [gr.Number(f'Score by {name}') for name in models.keys()]
# Action to perform on button click
submit_button.click(evaluate_model, inputs=input_text, outputs=output_scores)
# Launch the app
demo.launch()