gopalagra commited on
Commit
85aa063
Β·
verified Β·
1 Parent(s): fa5cf58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -38,7 +38,12 @@ def text_to_audio_file(text):
38
 
39
  return tmp_path
40
 
41
-
 
 
 
 
 
42
  # -------------------------------
43
  # Gradio interface: Caption + Audio
44
  # -------------------------------
 
38
 
39
  return tmp_path
40
 
41
+ def generate_caption_from_image(model, processor, image):
42
+ # image: PIL.Image
43
+ inputs = processor(images=image, return_tensors="pt")
44
+ out = model.generate(**inputs)
45
+ caption = processor.decode(out[0], skip_special_tokens=True)
46
+ return caption
47
  # -------------------------------
48
  # Gradio interface: Caption + Audio
49
  # -------------------------------