gskdsrikrishna commited on
Commit
cc14109
·
verified ·
1 Parent(s): 4c3b404

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,13 +12,13 @@ def generate_caption(image):
12
 
13
  # Preprocess the image and generate a detailed caption
14
  inputs = processor(images=image, return_tensors="pt")
15
- out = model.generate(**inputs, num_beams=5, max_length=500, early_stopping=True)
16
  caption = processor.decode(out[0], skip_special_tokens=True)
17
 
18
  end_time = time.time() # End time
19
  processing_time = end_time - start_time # Calculate processing time
20
 
21
- return caption, f"Time taken: {processing_time:.2f} seconds"
22
 
23
  # Function to handle cancellation (clear image and output)
24
  def cancel_action():
 
12
 
13
  # Preprocess the image and generate a detailed caption
14
  inputs = processor(images=image, return_tensors="pt")
15
+ out = model.generate(**inputs, num_beams=3, max_length=500, early_stopping=True)
16
  caption = processor.decode(out[0], skip_special_tokens=True)
17
 
18
  end_time = time.time() # End time
19
  processing_time = end_time - start_time # Calculate processing time
20
 
21
+ return caption, f"Time taken: {processing_time:.1f} seconds"
22
 
23
  # Function to handle cancellation (clear image and output)
24
  def cancel_action():