質問するログイン新規登録

質問編集履歴

2

更新

2021/12/13 08:17

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -206,16 +206,12 @@
206
206
  r_running = False
207
207
 
208
208
  while True:
209
- # プロセスrが動作していなくて、プロセスmの情報ができたらプロセスrを起動
210
209
  if not r_running and os.path.exists(count_image_path)== True:
211
- print("not & count")
212
210
  executor.submit(i.text_reading)
213
211
  r_running = True
214
212
  print(r_running)
215
- print("not & count",2)
216
213
 
217
214
  if not os.path.exists(count_image_path):
218
- print("falseになる")
219
215
  r_running = False
220
216
 
221
217
  if __name__ == '__main__':

1

更新

2021/12/13 08:17

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -193,8 +193,32 @@
193
193
  image = Image.open(image_path)
194
194
  description = sentence.replace('<start>',' ',1).replace('<end>',' ',1)
195
195
  print (description)
196
- os.remove(count_image_path)
196
+ os.remove(count_image_path)
197
-
197
+ def main():
198
+ if os.path.exists(count_image_path):
199
+ print("count_image_pathが存在するので削除します")
200
+ os.remove(count_image_path)
201
+
202
+ m = Main()
203
+ i = Image_captioning()
204
+ executor = concurrent.futures.ProcessPoolExecutor()
205
+ executor.submit(m.process)
206
+ r_running = False
198
207
 
208
+ while True:
209
+ # プロセスrが動作していなくて、プロセスmの情報ができたらプロセスrを起動
210
+ if not r_running and os.path.exists(count_image_path)== True:
211
+ print("not & count")
212
+ executor.submit(i.text_reading)
213
+ r_running = True
214
+ print(r_running)
215
+ print("not & count",2)
216
+
217
+ if not os.path.exists(count_image_path):
218
+ print("falseになる")
219
+ r_running = False
220
+
221
+ if __name__ == '__main__':
222
+ main()
199
223
 
200
224
  ```