Spaces:
Runtime error
Runtime error
aakashch0179
commited on
Commit
•
a7afcaa
1
Parent(s):
588eeb7
Update app.py
Browse files
app.py
CHANGED
@@ -53,20 +53,18 @@ import PyTorch
|
|
53 |
ckpt_id = "openai/shap-e"
|
54 |
|
55 |
@st.cache_resource # Caches the model for faster subsequent runs
|
56 |
-
def process_image_for_pil(image):
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
# Your existing Numpy conversion
|
61 |
-
# elif isinstance(image, list): # Assuming a nested list structure
|
62 |
-
# flattened_data = [pixel for sublist in image for pixel in sublist]
|
63 |
-
# image_array = np.array(flattened_data).reshape(256, 256, 3) # Hypothetical reshape
|
64 |
-
# return Image.fromarray(image_array)
|
65 |
else:
|
66 |
raise TypeError("Unsupported image format. Please provide conversion logic.")
|
67 |
|
68 |
|
69 |
|
|
|
|
|
70 |
def should_resize():
|
71 |
"""Determines whether to resize images (replace with your own logic)"""
|
72 |
# Example: Resize only if the image dimensions exceed a threshold
|
|
|
53 |
ckpt_id = "openai/shap-e"
|
54 |
|
55 |
@st.cache_resource # Caches the model for faster subsequent runs
|
56 |
+
def process_image_for_pil(image):
|
57 |
+
if isinstance(image, torch.Tensor):
|
58 |
+
# Your existing PyTorch conversion
|
59 |
+
elif isinstance(image, np.ndarray):
|
60 |
# Your existing Numpy conversion
|
|
|
|
|
|
|
|
|
61 |
else:
|
62 |
raise TypeError("Unsupported image format. Please provide conversion logic.")
|
63 |
|
64 |
|
65 |
|
66 |
+
|
67 |
+
|
68 |
def should_resize():
|
69 |
"""Determines whether to resize images (replace with your own logic)"""
|
70 |
# Example: Resize only if the image dimensions exceed a threshold
|