Spaces:
Running on Zero
Running on Zero
Added ZeroGPU GPU decorator
Browse files
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)
|