Spaces:
Sleeping
Sleeping
Valeriy Sinyukov
commited on
Commit
·
eaba143
1
Parent(s):
f390658
Add app.py with Streamlit UI
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
from src.category_classification.models import models as class_models
|
4 |
+
from src.common import Input
|
5 |
+
|
6 |
+
@st.cache_data
|
7 |
+
def load_class_model(name):
|
8 |
+
model = class_models.get_model(name)
|
9 |
+
return model
|
10 |
+
|
11 |
+
|
12 |
+
model_name = st.selectbox(
|
13 |
+
"Select model",
|
14 |
+
options=class_models.get_all_model_names()
|
15 |
+
)
|
16 |
+
title = st.text_area("Paper title")
|
17 |
+
abstract = st.text_area("Paper abstract")
|
18 |
+
|
19 |
+
if title:
|
20 |
+
input = Input(title=title, abstract=abstract)
|
21 |
+
model = load_class_model(model_name)
|
22 |
+
out = model(input)
|
23 |
+
st.json(out)
|