ShreyMehra commited on
Commit
8921743
·
unverified ·
1 Parent(s): 40de5f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -21,7 +21,6 @@ class UI:
21
  mod.load_model()
22
 
23
  def displayUI(self):
24
- print("display")
25
  image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
26
  if image is not None:
27
 
@@ -30,10 +29,13 @@ class UI:
30
 
31
  with st.spinner("🤖 AI is at Work! "):
32
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
33
  inputs = processor(images=image, return_tensors="pt").to(device, torch.float16)
34
- pixel_values = inputs.pixel_values
35
 
 
 
36
 
 
37
  generated_ids = model.generate(pixel_values=pixel_values, max_length=25)
38
  generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
39
 
@@ -68,7 +70,6 @@ class Model:
68
 
69
  def main():
70
  ui = UI()
71
- print("dis")
72
  ui.displayUI()
73
 
74
  if __name__ == "__main__":
 
21
  mod.load_model()
22
 
23
  def displayUI(self):
 
24
  image = st.file_uploader(label = "Upload your image here",type=['png','jpg','jpeg'])
25
  if image is not None:
26
 
 
29
 
30
  with st.spinner("🤖 AI is at Work! "):
31
  device = "cuda" if torch.cuda.is_available() else "cpu"
32
+ print(device, 1)
33
  inputs = processor(images=image, return_tensors="pt").to(device, torch.float16)
 
34
 
35
+ print(2)
36
+ pixel_values = inputs.pixel_values
37
 
38
+ print(3)
39
  generated_ids = model.generate(pixel_values=pixel_values, max_length=25)
40
  generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
41
 
 
70
 
71
  def main():
72
  ui = UI()
 
73
  ui.displayUI()
74
 
75
  if __name__ == "__main__":