Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
try:
|
3 |
+
from transformers import pipeline
|
4 |
+
except:
|
5 |
+
pass
|
6 |
+
|
7 |
+
st.markdown("## arXiv classificator")
|
8 |
+
st.markdown("<img width=700px src='https://eds-uga.github.io/csci1360e-su17/slides/Lecture21/arxiv.png'>", unsafe_allow_html=True)
|
9 |
+
st.markdown("Please type the article's title and abstract below")
|
10 |
+
|
11 |
+
title = st.text_input("Title")
|
12 |
+
abstract = st.text_input("Abstract")
|
13 |
+
|
14 |
+
try:
|
15 |
+
pipe = pipeline("ner", "Davlan/distilbert-base-multilingual-cased-ner-hrl")
|
16 |
+
raw_predictions = pipe(abstract)
|
17 |
+
st.markdown(f"The most likely arXiv tags for this article are:")# {raw_predictions}")
|
18 |
+
if raw_predictions:
|
19 |
+
for item in raw_predictions:
|
20 |
+
st.markdown(f"* {item}")
|
21 |
+
elif (title or abstract):
|
22 |
+
st.markdown("* cs.CV")
|
23 |
+
else:
|
24 |
+
st.markdown("Oops... your input is empty")
|
25 |
+
except:
|
26 |
+
st.markdown("Oops... something went wrong")
|