1
- # from rest_framework.decorators import api_view
2
1
from django .http import JsonResponse
3
- # from rest_framework.response import Response
4
- # from rest_framework import status
5
2
from channels import Group
6
3
from django .shortcuts import render
7
4
from django .views .decorators .csrf import csrf_exempt
15
12
import os
16
13
import random
17
14
import traceback
18
- # import urllib2
19
15
import demo .constants as constants
20
16
21
17
COCO_PARTIAL_IMAGE_NAME = constants .COCO_PARTIAL_IMAGE_NAME
@@ -32,16 +28,8 @@ def vilbert_multitask(request, template_name="index.html"):
32
28
input_images_list = request .POST .getlist ("image_list[]" )
33
29
print (input_images_list , input_question , task_id )
34
30
abs_image_path = []
35
- # if len(input_images_list) == 1:
36
- # abs_image_path.append(str(os.path.join(settings.BASE_DIR, str(input_images_list[0][1:]))))
37
- # print("Absoulte image path", abs_image_path)
38
- # elif len(input_images_list) == 2:
39
- # for i in range(len(input_images_list)):
40
- # abs_image_path.append(str(os.path.join(settings.BASE_DIR, str(input_images_list[i][1:]))))
41
- # else:
42
31
for i in range (len (input_images_list )):
43
32
abs_image_path .append (str (os .path .join (settings .BASE_DIR , str (input_images_list [i ][1 :]))))
44
- # out_dir = os.path.dirname(abs_image_path)
45
33
print (socketid , task_id , input_question , abs_image_path )
46
34
# Run the Model wrapper
47
35
log_to_terminal (socketid , {"terminal" : "Starting Vilbert Multitask Job..." })
@@ -105,11 +93,6 @@ def file_upload(request):
105
93
print ("Image" , images )
106
94
socketid = request .POST .get ('socketid' )
107
95
dir_type = constants .VILBERT_MULTITASK_CONFIG ['image_dir' ]
108
-
109
- # folder_uuid = uuid.uuid4()
110
- # output_dir = os.path.join(dir_type, str(folder_uuid))
111
- # if not os.path.exists(output_dir):
112
- # os.makedirs(output_dir)
113
96
file_paths = []
114
97
for i in images :
115
98
image_uuid = uuid .uuid4 ()
0 commit comments