drelhaj commited on
Commit
80132d7
·
verified ·
1 Parent(s): 9258edc

Upload 3 files

Browse files

initial demo upload

Files changed (3) hide show
  1. app.py +20 -0
  2. readme.md +33 -0
  3. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
+
4
+ model = AutoModelForSeq2SeqLM.from_pretrained("drelhaj/FinAraT5")
5
+ tokenizer = AutoTokenizer.from_pretrained("drelhaj/FinAraT5")
6
+
7
+ def summarize(text):
8
+ inputs = tokenizer(text, return_tensors="pt", truncation=True)
9
+ outputs = model.generate(**inputs, max_length=64)
10
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
11
+
12
+ demo = gr.Interface(
13
+ fn=summarize,
14
+ inputs=gr.Textbox(lines=5, placeholder="أدخل النص المالي هنا مع بادئة مثل 'لخص:'", label="النص المالي"),
15
+ outputs=gr.Textbox(label="الملخص"),
16
+ title="FinAraT5: ملخصات نصوص مالية باللغة العربية",
17
+ description="أدخل نصًا ماليًا باللغة العربية مبدوءًا بـ 'لخص:' للحصول على ملخص باستخدام نموذج FinAraT5."
18
+ )
19
+
20
+ demo.launch()
readme.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🧠 FinAraT5 – Arabic Financial Text Summarisation Demo
2
+
3
+ This Space provides an interactive demo of **[FinAraT5](https://huggingface.co/drelhaj/FinAraT5)** — a T5-based model fine-tuned for Arabic financial text summarisation.
4
+
5
+ You can enter Arabic financial news or reports prefixed with **"لخص:"** to generate concise summaries.
6
+
7
+ ---
8
+
9
+ ## ✨ Example Input
10
+
11
+ لخص: أعلنت الشركة عن ارتفاع أرباحها بنسبة ١٥٪ في الربع الثاني من العام نتيجة لزيادة المبيعات في السوق الخليجية.
12
+
13
+
14
+ ## 📤 Example Output
15
+
16
+ الشركة تحقق نمواً بنسبة ١٥٪ في أرباح الربع الثاني بفضل المبيعات الخليجية.
17
+
18
+
19
+ ---
20
+
21
+ ## 🏗️ Powered by
22
+
23
+ - [`drelhaj/FinAraT5`](https://huggingface.co/drelhaj/FinAraT5)
24
+ - [Transformers (🤗)](https://huggingface.co/transformers/)
25
+ - [Gradio](https://gradio.app)
26
+
27
+ ---
28
+
29
+ ## 📄 Citation
30
+
31
+ If you use this demo or model in your work, please cite the official paper:
32
+
33
+ > Nadhem Zmandar, Mo El-Haj, and Paul Rayson. 2023. FinAraT5: A text to text model for financial Arabic text understanding and generation. In Proceedings of the 4th Conference on Language, Data and Knowledge, pages 262–273, Vienna, Austria. NOVA CLUNL, Portugal https://aclanthology.org/2023.ldk-1.25/.
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio