import gradio as gr from inference import predict_absa, MODEL_OPTIONS def run_absa(review, model_choice): try: return predict_absa(review, model_choice) except Exception as e: return {"error": str(e)} #app demo = gr.Interface( fn=run_absa, inputs=[ gr.Textbox(label="Arabic Review"), gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Choose Model", value="Araberta") ], outputs=gr.JSON(label="Extracted Aspects and Sentiment"), title="Arabic ABSA (Aspect-Based Sentiment Analysis)", description="Write an Arabic review then choose a model to extract aspects and sentiment" ) if __name__ == "__main__": demo.launch()