Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import torch
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
import torch.nn.functional as F
|
@@ -13,7 +14,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
13 |
|
14 |
model.eval()
|
15 |
|
16 |
-
|
17 |
def predict(title, abstract):
|
18 |
text = f'''Given a certain paper, Title: {title}\n Abstract: {abstract}. \n Predict its normalized academic impact (between 0 and 1):'''
|
19 |
inputs = tokenizer(text, return_tensors="pt")
|
|
|
1 |
import gradio as gr
|
2 |
+
import spaces
|
3 |
import torch
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
5 |
import torch.nn.functional as F
|
|
|
14 |
|
15 |
model.eval()
|
16 |
|
17 |
+
@spaces.GPU
|
18 |
def predict(title, abstract):
|
19 |
text = f'''Given a certain paper, Title: {title}\n Abstract: {abstract}. \n Predict its normalized academic impact (between 0 and 1):'''
|
20 |
inputs = tokenizer(text, return_tensors="pt")
|