g8a9 commited on
Commit
a5e4816
1 Parent(s): f46ae84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -16,8 +16,6 @@ def get_model():
16
  feature_extractor = AutoFeatureExtractor.from_pretrained(CHECKPOINT)
17
  tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT)
18
 
19
- model.eval()
20
-
21
  st.title("Image Captioning with ViT & GePpeTto 🇮🇹")
22
 
23
  st.sidebar.markdown("## Generation parameters")
@@ -49,6 +47,7 @@ def generate_caption(url):
49
  image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
50
  inputs = feature_extractor(image, return_tensors="pt")
51
  model = get_model()
 
52
  generated_ids = model.generate(
53
  inputs["pixel_values"],
54
  max_length=20,
 
16
  feature_extractor = AutoFeatureExtractor.from_pretrained(CHECKPOINT)
17
  tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT)
18
 
 
 
19
  st.title("Image Captioning with ViT & GePpeTto 🇮🇹")
20
 
21
  st.sidebar.markdown("## Generation parameters")
 
47
  image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
48
  inputs = feature_extractor(image, return_tensors="pt")
49
  model = get_model()
50
+ model.eval()
51
  generated_ids = model.generate(
52
  inputs["pixel_values"],
53
  max_length=20,