Spaces:
Sleeping
Sleeping
Commit
·
4177079
1
Parent(s):
8e314e3
app
Browse files
app.py
CHANGED
|
@@ -5,16 +5,16 @@ def run_absa(review, model_choice):
|
|
| 5 |
try:
|
| 6 |
return predict_absa(review, model_choice)
|
| 7 |
except Exception as e:
|
| 8 |
-
return
|
| 9 |
|
| 10 |
-
#app
|
| 11 |
demo = gr.Interface(
|
| 12 |
fn=run_absa,
|
| 13 |
inputs=[
|
| 14 |
gr.Textbox(label="Arabic Review"),
|
| 15 |
gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Choose Model", value="Araberta")
|
| 16 |
],
|
| 17 |
-
outputs=gr.
|
| 18 |
title="Arabic ABSA (Aspect-Based Sentiment Analysis)",
|
| 19 |
description="Choose a model (Araberta, mT5, GPT) to extract aspects, opinions, and sentiment using LoRA adapters"
|
| 20 |
)
|
|
|
|
| 5 |
try:
|
| 6 |
return predict_absa(review, model_choice)
|
| 7 |
except Exception as e:
|
| 8 |
+
return {"error": str(e)} # JSON output for errors too
|
| 9 |
|
| 10 |
+
# app
|
| 11 |
demo = gr.Interface(
|
| 12 |
fn=run_absa,
|
| 13 |
inputs=[
|
| 14 |
gr.Textbox(label="Arabic Review"),
|
| 15 |
gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Choose Model", value="Araberta")
|
| 16 |
],
|
| 17 |
+
outputs=gr.JSON(label="Extracted Aspect-Sentiment-Opinion Triplets"), # ✅ JSON viewer
|
| 18 |
title="Arabic ABSA (Aspect-Based Sentiment Analysis)",
|
| 19 |
description="Choose a model (Araberta, mT5, GPT) to extract aspects, opinions, and sentiment using LoRA adapters"
|
| 20 |
)
|