Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
|
2 |
-
|
3 |
-
!pip install sentencepiece==0.1.94
|
4 |
-
!pip install transformers
|
5 |
from transformers import AutoTokenizer
|
6 |
|
7 |
-
!pip install huggingface_hub
|
8 |
from huggingface_hub import notebook_login
|
9 |
notebook_login()
|
10 |
|
@@ -17,8 +13,6 @@ from transformers import AutoModelForSeq2SeqLM
|
|
17 |
model1 = AutoModelForSeq2SeqLM.from_pretrained("Reham721/Subjective_QG")
|
18 |
model2 = AutoModelForSeq2SeqLM.from_pretrained("Reham721/MCQs")
|
19 |
|
20 |
-
!git clone https://github.com/aub-mind/arabert
|
21 |
-
!pip install pyarabic
|
22 |
|
23 |
from arabert.preprocess import ArabertPreprocessor
|
24 |
from transformers import pipeline
|
@@ -61,8 +55,7 @@ def get_sorted_questions(questions, context):
|
|
61 |
|
62 |
return dict(sorted(dic.items(), key=lambda item: item[1], reverse=True))
|
63 |
|
64 |
-
|
65 |
-
!pip install python-bidi
|
66 |
|
67 |
import unicodedata
|
68 |
import arabic_reshaper
|
@@ -140,7 +133,7 @@ def generate_distractors(question, answer, context, num_distractors=3, k=10):
|
|
140 |
|
141 |
return distractor_subset
|
142 |
|
143 |
-
|
144 |
|
145 |
import gradio as gr
|
146 |
|
@@ -167,9 +160,3 @@ iface = gr.Interface(
|
|
167 |
rtl=True)
|
168 |
|
169 |
iface.launch(debug=True,share=True) # will create a temporary sharable link
|
170 |
-
|
171 |
-
pip install --upgrade pip
|
172 |
-
|
173 |
-
pip install huggingface-spaces
|
174 |
-
|
175 |
-
!gradio deploy
|
|
|
1 |
|
|
|
|
|
|
|
2 |
from transformers import AutoTokenizer
|
3 |
|
|
|
4 |
from huggingface_hub import notebook_login
|
5 |
notebook_login()
|
6 |
|
|
|
13 |
model1 = AutoModelForSeq2SeqLM.from_pretrained("Reham721/Subjective_QG")
|
14 |
model2 = AutoModelForSeq2SeqLM.from_pretrained("Reham721/MCQs")
|
15 |
|
|
|
|
|
16 |
|
17 |
from arabert.preprocess import ArabertPreprocessor
|
18 |
from transformers import pipeline
|
|
|
55 |
|
56 |
return dict(sorted(dic.items(), key=lambda item: item[1], reverse=True))
|
57 |
|
58 |
+
|
|
|
59 |
|
60 |
import unicodedata
|
61 |
import arabic_reshaper
|
|
|
133 |
|
134 |
return distractor_subset
|
135 |
|
136 |
+
|
137 |
|
138 |
import gradio as gr
|
139 |
|
|
|
160 |
rtl=True)
|
161 |
|
162 |
iface.launch(debug=True,share=True) # will create a temporary sharable link
|
|
|
|
|
|
|
|
|
|
|
|