Spaces:
Runtime error
Runtime error
commit from
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
-
|
4 |
from transformers import AutoTokenizer, AutoModel
|
5 |
|
6 |
my_model_name = "istassiy/ysda_2022_ml2_hw3_distilbert_base_uncased"
|
@@ -80,11 +80,12 @@ paper_summary = st.text_area("Paper abstract")
|
|
80 |
if not paper_title and not paper_summary:
|
81 |
st.markdown(f"Must have non-empty title or summary")
|
82 |
else:
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
)
|
88 |
-
|
89 |
-
|
90 |
-
st.markdown(f"{results}")
|
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
+
import torch
|
4 |
from transformers import AutoTokenizer, AutoModel
|
5 |
|
6 |
my_model_name = "istassiy/ysda_2022_ml2_hw3_distilbert_base_uncased"
|
|
|
80 |
if not paper_title and not paper_summary:
|
81 |
st.markdown(f"Must have non-empty title or summary")
|
82 |
else:
|
83 |
+
with torch.no_grad():
|
84 |
+
raw_predictions = model(
|
85 |
+
**tokenizer(
|
86 |
+
[paper_title + "." + paper_summary],
|
87 |
+
padding=True, truncation=True, return_tensors="pt"
|
88 |
+
)
|
89 |
)
|
90 |
+
results = get_top_predictions(raw_predictions[0].numpy())
|
91 |
+
st.markdown(f"{results}")
|
|