ShreyMehra commited on
Commit
c7ccceb
·
unverified ·
1 Parent(s): ef72adb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -36,12 +36,12 @@ if image is not None:
36
 
37
  with st.spinner("🤖 AI is at Work! "):
38
  device = "cuda" if torch.cuda.is_available() else "cpu"
39
- inputs = st.session_state.dict['processor'](images=image, return_tensors="pt").to(device, torch.float16)
40
  pixel_values = inputs.pixel_values
41
 
42
 
43
- generated_ids = st.session_state.dict['model'].generate(pixel_values=pixel_values, max_length=25)
44
- generated_caption = st.session_state.dict['processor'].batch_decode(generated_ids, skip_special_tokens=True)[0]
45
 
46
  st.write(generated_caption)
47
 
 
36
 
37
  with st.spinner("🤖 AI is at Work! "):
38
  device = "cuda" if torch.cuda.is_available() else "cpu"
39
+ inputs = processor(images=image, return_tensors="pt").to(device, torch.float16)
40
  pixel_values = inputs.pixel_values
41
 
42
 
43
+ generated_ids = model.generate(pixel_values=pixel_values, max_length=25)
44
+ generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
45
 
46
  st.write(generated_caption)
47