Spaces:
Runtime error
Runtime error
Commit
·
07c84c4
1
Parent(s):
690384a
Add image resizing to display
Browse files
app.py
CHANGED
@@ -46,6 +46,8 @@ def read_markdown(path, parent="./sections/"):
|
|
46 |
|
47 |
def resize_height(image, new_height):
|
48 |
h, w, c = image.shape
|
|
|
|
|
49 |
|
50 |
checkpoints = ["./ckpt/ckpt-60k-5999"] # TODO: Maybe add more checkpoints?
|
51 |
dummy_data = pd.read_csv("dummy_vqa_multilingual.tsv", sep="\t")
|
@@ -110,11 +112,11 @@ if uploaded_file is not None:
|
|
110 |
state.image = np.array(Image.open(uploaded_file))
|
111 |
|
112 |
|
113 |
-
state.image =
|
114 |
transformed_image = get_transformed_image(state.image)
|
115 |
|
116 |
# Display Image
|
117 |
-
col1.image(state.image, use_column_width="
|
118 |
|
119 |
# Display Question
|
120 |
question = col2.text_input(label="Question", value=state.question)
|
|
|
46 |
|
47 |
def resize_height(image, new_height):
|
48 |
h, w, c = image.shape
|
49 |
+
new_width = int(w * new_height / h)
|
50 |
+
return cv2.resize(image, (new_width, new_height))
|
51 |
|
52 |
checkpoints = ["./ckpt/ckpt-60k-5999"] # TODO: Maybe add more checkpoints?
|
53 |
dummy_data = pd.read_csv("dummy_vqa_multilingual.tsv", sep="\t")
|
|
|
112 |
state.image = np.array(Image.open(uploaded_file))
|
113 |
|
114 |
|
115 |
+
state.image = resize_height(state.image, 224)
|
116 |
transformed_image = get_transformed_image(state.image)
|
117 |
|
118 |
# Display Image
|
119 |
+
col1.image(state.image, use_column_width="auto")
|
120 |
|
121 |
# Display Question
|
122 |
question = col2.text_input(label="Question", value=state.question)
|