Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
from bertopic import BERTopic
|
4 |
+
|
5 |
+
topic_model = BERTopic.load("TarekAi/ArBERTopic")
|
6 |
+
|
7 |
+
topic, prob = topic_model.transform("عدم إنجاز الواجبات المدرسية")
|
8 |
+
|
9 |
+
examples=["عدم الالتزام بالتشريع المنظم للحياة المدرسية من طرف الاستاذ", "عدم إنجاز الواجبات المدرسية"]
|
10 |
+
|
11 |
+
io = gr.Interface(fn=text_classification,
|
12 |
+
inputs= gr.Textbox(lines=2, label="Text", placeholder="Enter your idea here..."),
|
13 |
+
outputs=gr.Textbox(lines=2, label="Text Classification Result"),
|
14 |
+
title="Text Classification",
|
15 |
+
description="Enter a text and see the text classification result!",
|
16 |
+
examples=examples)
|
17 |
+
|
18 |
+
io.launch()
|