kovacsvi commited on
Commit
315aa5c
·
1 Parent(s): b7d12e0

added ZeroGPU import + decorator

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import torch
3
  import spacy
 
4
  import numpy as np
5
  import pandas as pd
6
  from transformers import AutoModelForSequenceClassification
@@ -51,6 +52,7 @@ def build_huggingface_path(language: str):
51
  return "visegradmedia-emotion/Emotion_RoBERTa_pooled_V4"
52
  return "poltextlab/xlm-roberta-large-pooled-MORES"
53
 
 
54
  def predict(text, model_id, tokenizer_id):
55
  model = AutoModelForSequenceClassification.from_pretrained(model_id, low_cpu_mem_usage=True, device_map="auto", offload_folder="offload", token=HF_TOKEN)
56
  tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
 
1
  import os
2
  import torch
3
  import spacy
4
+ import spaces
5
  import numpy as np
6
  import pandas as pd
7
  from transformers import AutoModelForSequenceClassification
 
52
  return "visegradmedia-emotion/Emotion_RoBERTa_pooled_V4"
53
  return "poltextlab/xlm-roberta-large-pooled-MORES"
54
 
55
+ @spaces.GPU
56
  def predict(text, model_id, tokenizer_id):
57
  model = AutoModelForSequenceClassification.from_pretrained(model_id, low_cpu_mem_usage=True, device_map="auto", offload_folder="offload", token=HF_TOKEN)
58
  tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)