File size: 789 Bytes
e3a1adb
3a93c8a
e3a1adb
3a93c8a
 
 
 
678fe06
3a93c8a
 
 
 
 
f4612ba
3a93c8a
829c9cb
9823a9e
aceadab
 
4556147
3a93c8a
 
 
6d4cbdb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()