unography commited on
Commit
49c0b12
·
verified ·
1 Parent(s): 113c1cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -26,12 +26,12 @@ torch.hub.download_url_to_file(
26
  "https://cdn.openai.com/dall-e-2/demos/text2im/astronaut/horse/photo/0.jpg", "astronaut.jpg"
27
  )
28
 
29
- @spaces.GPU(duration=30)
30
  def run(image: Union[str, PIL.Image.Image]) -> str:
31
  if isinstance(image, str):
32
  image = Image.open(image)
33
  inputs = processor(images=image, return_tensors="pt").to(device)
34
- out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, max_length=300)
35
  generated_caption = processor.decode(out[0], skip_special_tokens=True)
36
  return generated_caption
37
 
 
26
  "https://cdn.openai.com/dall-e-2/demos/text2im/astronaut/horse/photo/0.jpg", "astronaut.jpg"
27
  )
28
 
29
+ # @spaces.GPU(duration=30)
30
  def run(image: Union[str, PIL.Image.Image]) -> str:
31
  if isinstance(image, str):
32
  image = Image.open(image)
33
  inputs = processor(images=image, return_tensors="pt").to(device)
34
+ out = model.generate(pixel_values=inputs.pixel_values, num_beams=1, max_length=300)
35
  generated_caption = processor.decode(out[0], skip_special_tokens=True)
36
  return generated_caption
37