m-ric HF staff commited on
Commit
5abc01d
β€’
1 Parent(s): c3aa211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import torch
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import numpy as np
4
  import gradio as gr
 
5
 
6
  tokenizer = AutoTokenizer.from_pretrained("gpt2")
7
  model = AutoModelForCausalLM.from_pretrained("gpt2")
@@ -382,7 +383,7 @@ def generate_beams(start_sentence, scores, length_penalty, decoded_sequences):
382
 
383
  return original_tree
384
 
385
-
386
  def get_beam_search_html(input_text, number_steps, number_beams, length_penalty):
387
  inputs = tokenizer([input_text], return_tensors="pt")
388
 
 
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import numpy as np
4
  import gradio as gr
5
+ import spaces
6
 
7
  tokenizer = AutoTokenizer.from_pretrained("gpt2")
8
  model = AutoModelForCausalLM.from_pretrained("gpt2")
 
383
 
384
  return original_tree
385
 
386
+ @spaces.GPU
387
  def get_beam_search_html(input_text, number_steps, number_beams, length_penalty):
388
  inputs = tokenizer([input_text], return_tensors="pt")
389