from transformers import pipeline import gradio as gr # Load the text classification pipeline pipe = pipeline("text-classification", model="CAMeL-Lab/bert-base-arabic-camelbert-mix-sentiment") # Define the function to classify text def classify_text(text): result = pipe(text) return f"Label: {result[0]['label']}, Score: {result[0]['score']:.2f}" # Create the Gradio interface demo = gr.Interface( fn=classify_text, inputs="text", outputs="text", title="Arabic Text Classification", description="Enter Arabic text to analyze its sentiment using CAMeL-Lab's Arabic BERT model." ) # Launch the Gradio app demo.launch()