File size: 556 Bytes
3bf6c16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1eb3c4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

# Initialize the classifier pipeline
classifier = pipeline("text-classification", model="rahbi/alclam-base-v1-dialect-id")

# Define the prediction function
def classify_text(text):
    result = classifier(text)
    return result

# Create the Gradio interface
iface = gr.Interface(
    fn=classify_text,
    inputs="text",
    outputs="json",
    title="Arabic Text Classifier",
    description="Classify Arabic text using the rahbi/alclam-base-v1-DID model."
)

# Launch the interface
iface.launch()