add more debug info
Browse files
app.py
CHANGED
@@ -19,44 +19,45 @@ with zipfile.ZipFile(data_source, 'r') as zip_ref:
|
|
19 |
zip_ref.extractall('.')
|
20 |
print("unzip of dataset is done")
|
21 |
|
22 |
-
print("Going to find captions.csv")
|
23 |
-
find_txt_home = os.system("find /home/user/ -name captions.csv")
|
24 |
-
find_txt_usr = os.system("find /usr/ -name captions.csv")
|
25 |
-
print(find_txt_home)
|
26 |
-
print(find_txt_usr)
|
27 |
-
|
28 |
#=============================================
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
import subprocess
|
30 |
# shell command to run
|
31 |
cmd = "ls -l"
|
32 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
|
|
33 |
print(output1)
|
34 |
|
35 |
-
cmd = "pwd"
|
36 |
-
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
37 |
-
print(output1) # result => /home/user/app
|
38 |
#=============================================
|
39 |
-
print("Going to invoke make_train_valid_dfs")
|
40 |
-
print("\n\n")
|
41 |
|
|
|
42 |
df = pd.read_csv("captions.txt")
|
43 |
df['id'] = [id_ for id_ in range(df.shape[0] // 5) for _ in range(5)]
|
44 |
df.to_csv("captions.csv", index=False)
|
45 |
df = pd.read_csv("captions.csv")
|
|
|
|
|
46 |
|
|
|
47 |
_, valid_df = make_train_valid_dfs()
|
|
|
48 |
model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
|
49 |
|
50 |
|
51 |
-
|
52 |
def greet(query_text):
|
|
|
53 |
return inference_CLIP(query_text)
|
54 |
|
55 |
-
|
56 |
gallery = gr.Gallery(
|
57 |
label="Generated images", show_label=True, elem_id="gallery",
|
58 |
columns=[3], rows=[3], object_fit="contain", height="auto")
|
59 |
# btn = gr.Button("Generate images", scale=0)
|
60 |
demo = gr.Interface(fn=greet, inputs="text",
|
61 |
outputs=gallery)
|
|
|
62 |
demo.launch("debug")
|
|
|
19 |
zip_ref.extractall('.')
|
20 |
print("unzip of dataset is done")
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
#=============================================
|
23 |
+
|
24 |
+
cmd = "pwd"
|
25 |
+
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
26 |
+
print("result of pwd command")
|
27 |
+
print(output1) # result => /home/user/app
|
28 |
+
|
29 |
import subprocess
|
30 |
# shell command to run
|
31 |
cmd = "ls -l"
|
32 |
output1 = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
33 |
+
print("result of ls -l command")
|
34 |
print(output1)
|
35 |
|
|
|
|
|
|
|
36 |
#=============================================
|
|
|
|
|
37 |
|
38 |
+
print("Going to prepare captions.csv")
|
39 |
df = pd.read_csv("captions.txt")
|
40 |
df['id'] = [id_ for id_ in range(df.shape[0] // 5) for _ in range(5)]
|
41 |
df.to_csv("captions.csv", index=False)
|
42 |
df = pd.read_csv("captions.csv")
|
43 |
+
print("Finished in preparing captions.csv")
|
44 |
+
print("\n\n")
|
45 |
|
46 |
+
print("Going to invoke make_train_valid_dfs")
|
47 |
_, valid_df = make_train_valid_dfs()
|
48 |
+
print("Going to invoke make_train_valid_dfs")
|
49 |
model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
|
50 |
|
51 |
|
|
|
52 |
def greet(query_text):
|
53 |
+
print("Going to invoke inference_CLIP")
|
54 |
return inference_CLIP(query_text)
|
55 |
|
|
|
56 |
gallery = gr.Gallery(
|
57 |
label="Generated images", show_label=True, elem_id="gallery",
|
58 |
columns=[3], rows=[3], object_fit="contain", height="auto")
|
59 |
# btn = gr.Button("Generate images", scale=0)
|
60 |
demo = gr.Interface(fn=greet, inputs="text",
|
61 |
outputs=gallery)
|
62 |
+
print("Going to invoke demo.launch")
|
63 |
demo.launch("debug")
|