ssocean commited on
Commit
b5e7e03
·
verified ·
1 Parent(s): 9646494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -19,15 +19,13 @@ model.eval()
19
 
20
 
21
 
22
- @spaces.GPU
23
  def predict(title, abstract):
24
  model_device = next(model.parameters()).device
25
  text = f'''Given a certain paper, Title: {title}\n Abstract: {abstract}. \n Predict its normalized academic impact (between 0 and 1):'''
26
- inputs = tokenizer(text, return_tensors="pt").to(model_device)
27
-
28
  with torch.no_grad():
29
  outputs = model(**inputs)
30
-
31
  probability = torch.sigmoid(outputs.logits).item()
32
  # reason for +0.05: We observed that the predicted values in the web demo are generally around 0.05 lower than those in the local deployment (due to differences in software/hardware environments). Therefore, we applied the following compensation in the web demo. Please do not use this in the local deployment.
33
  if probability + 0.05 >=1.0:
 
19
 
20
 
21
 
22
+ @spaces.GPU(duration=60, enable_queue=True)
23
  def predict(title, abstract):
24
  model_device = next(model.parameters()).device
25
  text = f'''Given a certain paper, Title: {title}\n Abstract: {abstract}. \n Predict its normalized academic impact (between 0 and 1):'''
26
+ inputs = tokenizer(text, return_tensors="pt")
 
27
  with torch.no_grad():
28
  outputs = model(**inputs)
 
29
  probability = torch.sigmoid(outputs.logits).item()
30
  # reason for +0.05: We observed that the predicted values in the web demo are generally around 0.05 lower than those in the local deployment (due to differences in software/hardware environments). Therefore, we applied the following compensation in the web demo. Please do not use this in the local deployment.
31
  if probability + 0.05 >=1.0: