Spaces:
Running
Running
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)} | |
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="Results: Extracted Aspects & Sentiments"), | |
title="Arabic ABSA (Aspect-Based Sentiment Analysis) ", | |
description="Write a review and choose a model to extract aspects with sentiment", | |
allow_flagging="never", | |
article="Developed by Asma Shayea • Part of MSc Thesis Research", | |
) | |
if __name__ == "__main__": | |
demo.launch() | |