Spaces:
Running
Running
File size: 979 Bytes
1a31f06 49372bb a8ffde8 1a31f06 a8ffde8 1a31f06 49372bb 1a31f06 49372bb a8ffde8 1a31f06 49372bb | 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 27 28 | import gradio as gr
from transformers import pipeline
print("Loading models...")
quality_pipe = pipeline("text-classification", model="FareehaAly/fator-argument-quality", top_k=None)
fallacy_pipe = pipeline("text-classification", model="FareehaAly/fator-fallacy-detector", top_k=None)
print("Models loaded!")
def predict_quality(text):
return quality_pipe(text[:512])
def predict_fallacy(text):
return fallacy_pipe(text[:512])
with gr.Blocks() as demo:
gr.Markdown("## FATOR NLP API - Running")
with gr.Row():
txt = gr.Textbox(label="Input text", scale=4)
with gr.Row():
btn_q = gr.Button("Quality")
btn_f = gr.Button("Fallacy")
out_q = gr.JSON(label="Quality Result")
out_f = gr.JSON(label="Fallacy Result")
btn_q.click(predict_quality, inputs=txt, outputs=out_q, api_name="quality")
btn_f.click(predict_fallacy, inputs=txt, outputs=out_f, api_name="fallacy")
demo.launch(server_name="0.0.0.0", server_port=7860)
|