Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,9 @@ def get_arxiv_title_and_abstract(link):
|
|
41 |
|
42 |
|
43 |
def classify_paper(title, abstract):
|
|
|
|
|
|
|
44 |
text = f"TITLE\n{title}\n\nABSTRACT\n{abstract}"
|
45 |
item = classifier.tokenizer(text)
|
46 |
input_tensor = torch.tensor(item['input_ids'])[None]
|
@@ -71,6 +74,7 @@ with gr.Blocks(title='Paper classifier') as demo:
|
|
71 |
with gr.Column():
|
72 |
gr.Markdown('## Topics')
|
73 |
gr.Markdown('## ')
|
|
|
74 |
out = gr.Label(label="Topics")
|
75 |
b2.click(classify_paper, inputs=[title, abstract], outputs=out)
|
76 |
|
@@ -83,4 +87,4 @@ with gr.Blocks(title='Paper classifier') as demo:
|
|
83 |
cache_examples=True,
|
84 |
)
|
85 |
|
86 |
-
demo.launch()
|
|
|
41 |
|
42 |
|
43 |
def classify_paper(title, abstract):
|
44 |
+
if title == '' and abstract == '':
|
45 |
+
raise gr.Error('Fill Title or/and Abstract')
|
46 |
+
|
47 |
text = f"TITLE\n{title}\n\nABSTRACT\n{abstract}"
|
48 |
item = classifier.tokenizer(text)
|
49 |
input_tensor = torch.tensor(item['input_ids'])[None]
|
|
|
74 |
with gr.Column():
|
75 |
gr.Markdown('## Topics')
|
76 |
gr.Markdown('## ')
|
77 |
+
gr.Markdown('## ')
|
78 |
out = gr.Label(label="Topics")
|
79 |
b2.click(classify_paper, inputs=[title, abstract], outputs=out)
|
80 |
|
|
|
87 |
cache_examples=True,
|
88 |
)
|
89 |
|
90 |
+
demo.launch(share=True)
|