Spaces:
Runtime error
Runtime error
from skk import summarizer | |
import torch | |
import gradio | |
CHECKPOINT = 'checkpoints/scisumm-bart-cnn.ckpt' | |
model = summarizer.LitModel.load_from_checkpoint( | |
CHECKPOINT, | |
model = summarizer.base_model, | |
tokenizer = summarizer.tokenizer | |
) | |
def summarize(s): | |
model.eval() | |
tok_s = summarizer.tokenizer( | |
s, | |
return_tensors = 'pt', | |
truncation = True | |
) | |
return model.generate(tok_s)[0] | |
# s = 'Given two images of different anime roles, anime style recognition (ASR) aims to learn abstract painting style to determine whether the two images are from the same work, which is an interesting but challenging problem. Unlike biometric recognition, such as face recognition, iris recognition, and person re-identification, ASR suffers from a much larger semantic gap but receives less attention. In this paper, we propose a challenging ASR benchmark. Firstly, we collect a large-scale ASR dataset (LSASRD), which contains 20,937 images of 190 anime works and each work at least has ten different roles. In addition to the large-scale, LSASRD contains a list of challenging factors, such as complex illuminations, various poses, theatrical colors and exaggerated compositions. Secondly, we design a cross-role protocol to evaluate ASR performance, in which query and gallery images must come from different roles to validate an ASR model is to learn abstract painting style rather than learn discriminative features of roles. Finally, we apply two powerful person re-identification methods, namely, AGW and TransReID, to construct the baseline performance on LSASRD. Surprisingly, the recent transformer model (i.e., TransReID) only acquires a 42.24% mAP on LSASRD. Therefore, we believe that the ASR task of a huge semantic gap deserves deep and long-term research.' | |
# print(' '.join(summarize(s).split())) | |
app = gradio.Interface( | |
fn = summarize, | |
inputs = gradio.Textbox(placeholder = 'Paste The Abstract Here', label = 'Abstract'), | |
outputs = gradio.Textbox(label = 'Summary'), | |
title = 'Paper Abstract Summarizer', | |
description = 'A text summarizer to summarize paper abstract' | |
) | |
def main(): | |
app.launch() | |
if __name__ == '__main__': | |
main() |