Spaces:
Sleeping
Sleeping
File size: 1,173 Bytes
c4184ed 977b742 c4184ed e276d6e c4184ed e276d6e c4184ed 2bde448 c4184ed |
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 |
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)[0]['score'] * 6 if model_name != 'devngho/ko_edu_classifier_v2_nlpai-lab_KoE5' else model('passage: ' + input_text)[0]['score'] * 6 for model_name, model in models.items()]
# Gradio interface
with gr.Blocks() as demo:
input_text = gr.Textbox(label="Input Text", lines=10)
submit_button = gr.Button("Evaluate")
output_scores = [gr.Number(label=f'Score by {name}', show_label=True) 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()
|