Spaces:
Runtime error
Runtime error
Commit
·
821f153
1
Parent(s):
b2f8c9b
Change app to take resized images
Browse files
app.py
CHANGED
@@ -43,12 +43,6 @@ def read_markdown(path, parent="./sections/"):
|
|
43 |
with open(os.path.join(parent, path)) as f:
|
44 |
return f.read()
|
45 |
|
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/vqa/ckpt-60k-5999"] # TODO: Maybe add more checkpoints?
|
53 |
dummy_data = pd.read_csv("dummy_vqa_multilingual.tsv", sep="\t")
|
54 |
code_to_name = {
|
@@ -105,7 +99,7 @@ if state.image_file is None:
|
|
105 |
state.question_lang_id = dummy_data.loc[first_index, "lang_id"]
|
106 |
state.answer_lang_id = dummy_data.loc[first_index, "lang_id"]
|
107 |
|
108 |
-
image_path = os.path.join("
|
109 |
image = plt.imread(image_path)
|
110 |
state.image = image
|
111 |
|
@@ -122,7 +116,7 @@ if st.button(
|
|
122 |
state.question_lang_id = sample.loc[0, "lang_id"]
|
123 |
state.answer_lang_id = sample.loc[0, "lang_id"]
|
124 |
|
125 |
-
image_path = os.path.join("
|
126 |
image = plt.imread(image_path)
|
127 |
state.image = image
|
128 |
|
|
|
43 |
with open(os.path.join(parent, path)) as f:
|
44 |
return f.read()
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
checkpoints = ["./ckpt/vqa/ckpt-60k-5999"] # TODO: Maybe add more checkpoints?
|
47 |
dummy_data = pd.read_csv("dummy_vqa_multilingual.tsv", sep="\t")
|
48 |
code_to_name = {
|
|
|
99 |
state.question_lang_id = dummy_data.loc[first_index, "lang_id"]
|
100 |
state.answer_lang_id = dummy_data.loc[first_index, "lang_id"]
|
101 |
|
102 |
+
image_path = os.path.join("resized_images", state.image_file)
|
103 |
image = plt.imread(image_path)
|
104 |
state.image = image
|
105 |
|
|
|
116 |
state.question_lang_id = sample.loc[0, "lang_id"]
|
117 |
state.answer_lang_id = sample.loc[0, "lang_id"]
|
118 |
|
119 |
+
image_path = os.path.join("resized_images", state.image_file)
|
120 |
image = plt.imread(image_path)
|
121 |
state.image = image
|
122 |
|