Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Initialize the classifier pipeline
|
| 5 |
+
classifier = pipeline("text-classification", model="rahbi/alclam-base-v1-DID")
|
| 6 |
+
|
| 7 |
+
# Define the prediction function
|
| 8 |
+
def classify_text(text):
|
| 9 |
+
result = classifier(text)
|
| 10 |
+
return result
|
| 11 |
+
|
| 12 |
+
# Create the Gradio interface
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=classify_text,
|
| 15 |
+
inputs="text",
|
| 16 |
+
outputs="json",
|
| 17 |
+
title="Arabic Text Classifier",
|
| 18 |
+
description="Classify Arabic text using the rahbi/alclam-base-v1-DID model."
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Launch the interface
|
| 22 |
+
iface.launch()
|