Skip to content

Commit a2adb0b

Browse files
committed
clean deps
1 parent 5bad9f9 commit a2adb0b

File tree

3 files changed

+30
-1472
lines changed

3 files changed

+30
-1472
lines changed

pyproject.toml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
[project]
2-
name = "aws-hf-model-deployment"
2+
name = "aws-sagemaker-hf-model-deployment"
33
version = "0.1.0"
4-
description = "Add your description here"
4+
description = "AWS SageMaker Hugging Face Model Deployment"
55
readme = "README.md"
66
requires-python = ">=3.12"
7-
dependencies = [
8-
"huggingface-hub[cli]>=0.27.1",
9-
"humanize>=4.11.0",
10-
"transformers[torch]>=4.48.0",
11-
]
12-
13-
[dependency-groups]
14-
dev = [
15-
"boto3>=1.35.97",
16-
"pytest>=8.3.4",
17-
"sagemaker-huggingface-inference-toolkit>=2.4.1",
18-
]
7+
dependencies = ["boto3>=1.35.97"]
198

209
[tool.mypy]
2110
disallow_untyped_calls = true

test_endpoint.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import boto3
44

55
AWS_REGION = "us-east-1"
6-
ENDPOINT_NAME = "dev-multilingual-sentiment-analysis-endpoint"
6+
ENDPOINT_NAME = "test-multilingual-sentiment-analysis-endpoint"
77

88
sagemaker_runtime = boto3.client("sagemaker-runtime", region_name=AWS_REGION)
99

@@ -89,9 +89,13 @@
8989
response = sagemaker_runtime.invoke_endpoint(
9090
EndpointName=ENDPOINT_NAME,
9191
ContentType="application/json",
92-
Body=json.dumps(texts),
92+
Body=json.dumps({"inputs": texts}),
9393
)
9494

9595

96-
result = json.loads(response["Body"].read().decode())
97-
print("Predicted sentiment:", result)
96+
result = json.loads(response["Body"].read())
97+
98+
for text, sentiment in zip(texts, result):
99+
print(f"Text: {text}")
100+
print(f"Sentiment: {sentiment}")
101+
print()

0 commit comments

Comments
 (0)