philipp-zettl commited on
Commit
5165f2d
1 Parent(s): 31a57b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import torch
 
3
  from transformers import pipeline
4
  from transformers import AutoModelForCausalLM, AutoTokenizer
5
 
@@ -8,6 +9,8 @@ device = 'cuda' if torch.cuda.is_available() else 'cpu'
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
  model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
10
 
 
 
11
  def respond(
12
  message,
13
  history: list[tuple[str, str]],
 
1
  import gradio as gr
2
  import torch
3
+ import spaces
4
  from transformers import pipeline
5
  from transformers import AutoModelForCausalLM, AutoTokenizer
6
 
 
9
  tokenizer = AutoTokenizer.from_pretrained(model_name)
10
  model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
11
 
12
+
13
+ @spaces.GPU(duration=120)
14
  def respond(
15
  message,
16
  history: list[tuple[str, str]],