Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,15 +50,17 @@ def analyze_text(text):
|
|
| 50 |
stats = compute_metrics(text)
|
| 51 |
return {"Predicted_Label": label, **stats}
|
| 52 |
|
| 53 |
-
# ✅ This
|
| 54 |
demo = gr.Interface(
|
| 55 |
fn=analyze_text,
|
| 56 |
inputs=gr.Textbox(label="أدخل النص العربي هنا", lines=6),
|
| 57 |
outputs=gr.JSON(label="نتائج التحليل"),
|
| 58 |
-
api_name="predict",
|
| 59 |
title="Arabic Readability Analyzer",
|
| 60 |
description="أداة ذكية لتقييم مقروئية النصوص العربية باستخدام نموذج AraBERT."
|
| 61 |
)
|
| 62 |
|
| 63 |
-
# ✅ Launch
|
| 64 |
-
|
|
|
|
|
|
|
|
|
| 50 |
stats = compute_metrics(text)
|
| 51 |
return {"Predicted_Label": label, **stats}
|
| 52 |
|
| 53 |
+
# ✅ This creates a Space API endpoint
|
| 54 |
demo = gr.Interface(
|
| 55 |
fn=analyze_text,
|
| 56 |
inputs=gr.Textbox(label="أدخل النص العربي هنا", lines=6),
|
| 57 |
outputs=gr.JSON(label="نتائج التحليل"),
|
| 58 |
+
api_name="predict",
|
| 59 |
title="Arabic Readability Analyzer",
|
| 60 |
description="أداة ذكية لتقييم مقروئية النصوص العربية باستخدام نموذج AraBERT."
|
| 61 |
)
|
| 62 |
|
| 63 |
+
# ✅ Launch safely (Gradio v4+)
|
| 64 |
+
if __name__ == "__main__":
|
| 65 |
+
demo.queue()
|
| 66 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|