prepare captions.csv
Browse files
app.py
CHANGED
@@ -31,17 +31,18 @@ cmd = "ls -l"
|
|
31 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
32 |
print(output1)
|
33 |
|
34 |
-
cmd = "ls Images"
|
35 |
-
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
36 |
-
print(output1)
|
37 |
-
|
38 |
cmd = "pwd"
|
39 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
40 |
-
print(output1)
|
41 |
#=============================================
|
42 |
print("Going to invoke make_train_valid_dfs")
|
43 |
print("\n\n")
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
_, valid_df = make_train_valid_dfs()
|
46 |
model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
|
47 |
|
|
|
31 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
32 |
print(output1)
|
33 |
|
|
|
|
|
|
|
|
|
34 |
cmd = "pwd"
|
35 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
36 |
+
print(output1) # result => /home/user/app
|
37 |
#=============================================
|
38 |
print("Going to invoke make_train_valid_dfs")
|
39 |
print("\n\n")
|
40 |
|
41 |
+
df = pd.read_csv("captions.txt")
|
42 |
+
df['id'] = [id_ for id_ in range(df.shape[0] // 5) for _ in range(5)]
|
43 |
+
df.to_csv("captions.csv", index=False)
|
44 |
+
df = pd.read_csv("captions.csv")
|
45 |
+
|
46 |
_, valid_df = make_train_valid_dfs()
|
47 |
model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
|
48 |
|