Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -89,6 +89,7 @@ def load_rgbx(image_path, x_image_path):
|
|
| 89 |
|
| 90 |
class Ready: pass
|
| 91 |
|
|
|
|
| 92 |
def model_worker(
|
| 93 |
rank: int, args: argparse.Namespace, barrier: mp.Barrier,
|
| 94 |
request_queue: mp.Queue, response_queue: Optional[mp.Queue] = None,
|
|
@@ -144,22 +145,25 @@ def model_worker(
|
|
| 144 |
if response_queue is not None:
|
| 145 |
response_queue.put(Ready())
|
| 146 |
img_path, audio_path, video_path, point_path, fmri_path, depth_path, depth_rgb_path, normal_path, normal_rgb_path, chatbot, max_gen_len, temperature, top_p, modality = request_queue.get()
|
| 147 |
-
|
| 148 |
-
image
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
| 163 |
inputs = None
|
| 164 |
|
| 165 |
if inputs is not None:
|
|
|
|
| 89 |
|
| 90 |
class Ready: pass
|
| 91 |
|
| 92 |
+
|
| 93 |
def model_worker(
|
| 94 |
rank: int, args: argparse.Namespace, barrier: mp.Barrier,
|
| 95 |
request_queue: mp.Queue, response_queue: Optional[mp.Queue] = None,
|
|
|
|
| 145 |
if response_queue is not None:
|
| 146 |
response_queue.put(Ready())
|
| 147 |
img_path, audio_path, video_path, point_path, fmri_path, depth_path, depth_rgb_path, normal_path, normal_rgb_path, chatbot, max_gen_len, temperature, top_p, modality = request_queue.get()
|
| 148 |
+
try:
|
| 149 |
+
if 'image' in modality and img_path is not None:
|
| 150 |
+
image = Image.open(img_path).convert('RGB')
|
| 151 |
+
inputs = T_random_resized_crop(image)
|
| 152 |
+
elif 'video' in modality and video_path is not None:
|
| 153 |
+
inputs = load_video(video_path)
|
| 154 |
+
elif 'audio' in modality and audio_path is not None:
|
| 155 |
+
inputs = load_audio(audio_path)
|
| 156 |
+
elif 'point' in modality and point_path is not None:
|
| 157 |
+
inputs = load_point(point_path)
|
| 158 |
+
elif 'fmri' in modality and fmri_path is not None:
|
| 159 |
+
inputs = load_fmri(fmri_path)
|
| 160 |
+
elif 'rgbd' in modality and depth_path is not None and depth_rgb_path is not None:
|
| 161 |
+
inputs = load_rgbx(depth_rgb_path, depth_path)
|
| 162 |
+
elif 'rgbn' in modality and normal_path is not None and normal_rgb_path is not None:
|
| 163 |
+
inputs = load_rgbx(normal_rgb_path, normal_path)
|
| 164 |
+
else:
|
| 165 |
+
inputs = None
|
| 166 |
+
except:
|
| 167 |
inputs = None
|
| 168 |
|
| 169 |
if inputs is not None:
|