Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
quality_pipe = pipeline("text-classification", model="FareehaAly/fator-argument-quality", top_k=None)
|
| 5 |
+
fallacy_pipe = pipeline("text-classification", model="FareehaAly/fator-fallacy-detector", top_k=None)
|
| 6 |
+
|
| 7 |
+
def predict_quality(text):
|
| 8 |
+
return quality_pipe(text[:512])
|
| 9 |
+
|
| 10 |
+
def predict_fallacy(text):
|
| 11 |
+
return fallacy_pipe(text[:512])
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as app:
|
| 14 |
+
with gr.Tab("Quality"):
|
| 15 |
+
gr.Interface(fn=predict_quality, inputs="text", outputs="json")
|
| 16 |
+
with gr.Tab("Fallacy"):
|
| 17 |
+
gr.Interface(fn=predict_fallacy, inputs="text", outputs="json")
|
| 18 |
+
|
| 19 |
+
app.launch()
|