Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,31 +9,29 @@ import os
|
|
| 9 |
#import gdown
|
| 10 |
#url = 'https://drive.google.com/drive/folders/135hTTURfjn43fo4f?usp=sharing' # I'm showing a fake token
|
| 11 |
#gdown.download_folder(url)
|
| 12 |
-
os.system("pip install huggingface_hub")
|
| 13 |
#os.system("git clone https://huggingface.co/AfnanAl/summaryAonnx")
|
| 14 |
|
| 15 |
-
|
| 16 |
-
repo = Repository(
|
| 17 |
-
local_dir = 'summaryAonnx',
|
| 18 |
-
clone_from='AfnanAl/summaryAonnx'
|
| 19 |
-
)
|
| 20 |
|
| 21 |
#m=os.system("gdown https://drive.google.com/file/d/152leR0f_2RXIVyZxV1ZYDpRMMYYGBhOk/view?usp=sharing")
|
| 22 |
|
| 23 |
#os.system("unzip 'summary-T5_v6.zip'")
|
| 24 |
|
| 25 |
tokenizer = T5Tokenizer.from_pretrained("AfnanAl/mT5small-ArabicSummary")
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
model_name="AfnanAl/mT5small-ArabicSummary"
|
| 28 |
-
custom_output_path="summaryAonnx/"
|
| 29 |
|
| 30 |
#print(quantized_model)
|
| 31 |
#modelO = quantize("AfnanAl/summaryAonnx")
|
| 32 |
-
modelO=get_onnx_model(model_name, custom_output_path)
|
| 33 |
-
modelO.config.max_length=512
|
| 34 |
def summaryA(Text):
|
| 35 |
tokenized_text = tokenizer.encode(Text,return_tensors="pt")
|
| 36 |
-
summary_ids =
|
| 37 |
tokenized_text,
|
| 38 |
num_beams=4,
|
| 39 |
length_penalty=2.0,
|
|
|
|
| 9 |
#import gdown
|
| 10 |
#url = 'https://drive.google.com/drive/folders/135hTTURfjn43fo4f?usp=sharing' # I'm showing a fake token
|
| 11 |
#gdown.download_folder(url)
|
| 12 |
+
#os.system("pip install huggingface_hub")
|
| 13 |
#os.system("git clone https://huggingface.co/AfnanAl/summaryAonnx")
|
| 14 |
|
| 15 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
#m=os.system("gdown https://drive.google.com/file/d/152leR0f_2RXIVyZxV1ZYDpRMMYYGBhOk/view?usp=sharing")
|
| 18 |
|
| 19 |
#os.system("unzip 'summary-T5_v6.zip'")
|
| 20 |
|
| 21 |
tokenizer = T5Tokenizer.from_pretrained("AfnanAl/mT5small-ArabicSummary")
|
| 22 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("AfnanAl/mT5small-ArabicSummary")
|
| 23 |
+
model.config.max_length=512
|
| 24 |
|
| 25 |
+
#model_name="AfnanAl/mT5small-ArabicSummary"
|
| 26 |
+
#custom_output_path="summaryAonnx/"
|
| 27 |
|
| 28 |
#print(quantized_model)
|
| 29 |
#modelO = quantize("AfnanAl/summaryAonnx")
|
| 30 |
+
#modelO=get_onnx_model(model_name, custom_output_path)
|
| 31 |
+
#modelO.config.max_length=512
|
| 32 |
def summaryA(Text):
|
| 33 |
tokenized_text = tokenizer.encode(Text,return_tensors="pt")
|
| 34 |
+
summary_ids = model.generate(
|
| 35 |
tokenized_text,
|
| 36 |
num_beams=4,
|
| 37 |
length_penalty=2.0,
|