PypCoder commited on
Commit
24cfb3f
·
verified ·
1 Parent(s): 0639ef1

Added ZeroGPU GPU decorator

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import torch
3
  import torch.nn as nn
4
  from huggingface_hub import hf_hub_download
@@ -47,6 +48,7 @@ model.load_state_dict(checkpoint["model_state_dict"])
47
  model.eval()
48
  print("SERAPH ready.")
49
 
 
50
  def predict(sequence: str) -> dict:
51
  sequence = sequence.upper().strip()
52
  tokens = tokenizer(sequence, return_tensors="pt", truncation=True, max_length=512)
 
1
  import gradio as gr
2
+ import spaces
3
  import torch
4
  import torch.nn as nn
5
  from huggingface_hub import hf_hub_download
 
48
  model.eval()
49
  print("SERAPH ready.")
50
 
51
+ @spaces.GPU
52
  def predict(sequence: str) -> dict:
53
  sequence = sequence.upper().strip()
54
  tokens = tokenizer(sequence, return_tensors="pt", truncation=True, max_length=512)