Spaces:
Runtime error
Runtime error
lowercasing text
Browse files
app.py
CHANGED
|
@@ -81,7 +81,7 @@ else:
|
|
| 81 |
show = st.image(image)
|
| 82 |
show.image(image, "Your Image")
|
| 83 |
|
| 84 |
-
gen_show_caption(sub, cap_prompt)
|
| 85 |
|
| 86 |
image.close()
|
| 87 |
|
|
|
|
| 81 |
show = st.image(image)
|
| 82 |
show.image(image, "Your Image")
|
| 83 |
|
| 84 |
+
gen_show_caption(sub, imageLoader.text_transform(cap_prompt))
|
| 85 |
|
| 86 |
image.close()
|
| 87 |
|
model.py
CHANGED
|
@@ -36,6 +36,9 @@ class ImageLoader():
|
|
| 36 |
def transform(self, image):
|
| 37 |
im = torch.FloatTensor(self.transformer(image)).unsqueeze(0)
|
| 38 |
return {"image": im}
|
|
|
|
|
|
|
|
|
|
| 39 |
def to_image(self, tensor):
|
| 40 |
return torchvision.transforms.ToPILImage()(tensor)
|
| 41 |
|
|
|
|
| 36 |
def transform(self, image):
|
| 37 |
im = torch.FloatTensor(self.transformer(image)).unsqueeze(0)
|
| 38 |
return {"image": im}
|
| 39 |
+
def text_transform(self, text):
|
| 40 |
+
# at present just lowercasing:
|
| 41 |
+
return text.lower()
|
| 42 |
def to_image(self, tensor):
|
| 43 |
return torchvision.transforms.ToPILImage()(tensor)
|
| 44 |
|