amaye15
commited on
Commit
·
ffbf25c
1
Parent(s):
3f75720
Debug - Delpoyment
Browse files- .gitignore +2 -1
- requirements.txt +3 -25
- test_handler.py +29 -0
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
*env*
|
2 |
-
*.DS_Store*
|
|
|
|
1 |
*env*
|
2 |
+
*.DS_Store*
|
3 |
+
*__pycache__*
|
requirements.txt
CHANGED
@@ -1,27 +1,5 @@
|
|
1 |
-
accelerate==1.3.0
|
2 |
-
certifi==2024.12.14
|
3 |
-
charset-normalizer==3.4.1
|
4 |
-
filelock==3.17.0
|
5 |
-
fsspec==2024.12.0
|
6 |
-
huggingface-hub==0.27.1
|
7 |
-
idna==3.10
|
8 |
-
Jinja2==3.1.5
|
9 |
-
MarkupSafe==3.0.2
|
10 |
-
mpmath==1.3.0
|
11 |
-
networkx==3.4.2
|
12 |
-
numpy==2.2.2
|
13 |
-
packaging==24.2
|
14 |
-
pillow==11.1.0
|
15 |
-
psutil==6.1.1
|
16 |
-
PyYAML==6.0.2
|
17 |
-
regex==2024.11.6
|
18 |
-
requests==2.32.3
|
19 |
-
safetensors==0.5.2
|
20 |
-
setuptools==75.8.0
|
21 |
-
sympy==1.13.1
|
22 |
-
tokenizers==0.21.0
|
23 |
torch==2.5.1
|
24 |
-
tqdm==4.67.1
|
25 |
transformers==4.48.1
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
torch==2.5.1
|
|
|
2 |
transformers==4.48.1
|
3 |
+
accelerate==1.3.0
|
4 |
+
pillow==11.1.0
|
5 |
+
|
test_handler.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
+
from io import BytesIO
|
3 |
+
import requests
|
4 |
+
from PIL import Image
|
5 |
+
|
6 |
+
# Import the EndpointHandler class
|
7 |
+
from handler import EndpointHandler
|
8 |
+
|
9 |
+
# Fetch the image from the URL
|
10 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
11 |
+
response = requests.get(url, stream=True)
|
12 |
+
image = Image.open(response.raw).convert("RGB") # Ensure the image is in RGB format
|
13 |
+
|
14 |
+
# Encode the image as base64
|
15 |
+
buffered = BytesIO()
|
16 |
+
image.save(buffered, format="JPEG") # Save the image to a buffer in JPEG format
|
17 |
+
encoded_image = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
18 |
+
|
19 |
+
# Prepare the input data
|
20 |
+
data = {"images": [encoded_image]}
|
21 |
+
|
22 |
+
# Initialize the handler
|
23 |
+
handler = EndpointHandler()
|
24 |
+
|
25 |
+
# Process the image
|
26 |
+
result = handler(data)
|
27 |
+
|
28 |
+
# Print the result
|
29 |
+
print(result)
|