import gradio as gr from transformers import pipeline deployed_repo_id = "maryaa4/my-arabic-sentiment-model" loaded_sentiment_pipeline = pipeline('sentiment-analysis', model=deployed_repo_id, trust_remote_code=True) def predict_sentiment(text): if not text: return "Please enter some text for sentiment analysis." result = loaded_sentiment_pipeline(text) label = result[0]['label'] score = result[0]['score'] return f"Sentiment: {label.capitalize()}, Confidence: {score:.4f}" iface = gr.Interface( fn=predict_sentiment, inputs=gr.Textbox(lines=5, placeholder="أدخل النص العربي هنا..."), outputs="text", title="Arabic Sentiment Analysis", description=f"A sentiment analysis model for Arabic text, deployed from maryaa4/my-arabic-sentiment-model. Enter Arabic text and get the predicted sentiment." ) iface.launch(share=True) # share=True for a temporary public link