pwnshx commited on
Commit
fd7845c
·
verified ·
1 Parent(s): 48054f0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -6
README.md CHANGED
@@ -69,20 +69,30 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
69
  ## Sagemaker Endpoint I/O Example
70
 
71
 
72
- ```js
73
- {
74
  "inputs": "### Schema and the Natural Language Query:\nCREATE TABLE stadium (\n stadium_id number,\n location text,\n name text,\n capacity number,\n highest number,\n lowest number,\n average number\n)\n\nCREATE TABLE singer (\n singer_id number,\n name text,\n country text,\n song_name text,\n song_release_year text,\n age number,\n is_male others\n)\n\nCREATE TABLE concert (\n concert_id number,\n concert_name text,\n theme text,\n stadium_id text,\n year text\n)\n\nCREATE TABLE singer_in_concert (\n concert_id number,\n singer_id text\n)\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What is the maximum, the average, and the minimum capacity of stadiums ?",
75
  "parameters": {
76
  "maxNewTokens": 512,
77
  "topP": 0.9,
78
- "temperature": 0.2,
79
- "decoderInputDetails": true,
80
- "details": true
81
  }
82
  }
 
 
 
 
 
 
 
 
 
 
 
 
83
  ```
84
 
85
- ```js
86
  {
87
  "body": [
88
  {
 
69
  ## Sagemaker Endpoint I/O Example
70
 
71
 
72
+ ```py
73
+ payload = {
74
  "inputs": "### Schema and the Natural Language Query:\nCREATE TABLE stadium (\n stadium_id number,\n location text,\n name text,\n capacity number,\n highest number,\n lowest number,\n average number\n)\n\nCREATE TABLE singer (\n singer_id number,\n name text,\n country text,\n song_name text,\n song_release_year text,\n age number,\n is_male others\n)\n\nCREATE TABLE concert (\n concert_id number,\n concert_name text,\n theme text,\n stadium_id text,\n year text\n)\n\nCREATE TABLE singer_in_concert (\n concert_id number,\n singer_id text\n)\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What is the maximum, the average, and the minimum capacity of stadiums ?",
75
  "parameters": {
76
  "maxNewTokens": 512,
77
  "topP": 0.9,
78
+ "temperature": 0.2
 
 
79
  }
80
  }
81
+
82
+ client = boto3.client('runtime.sagemaker')
83
+ endpoint_name = 'deployed_model_name'
84
+ response = client.invoke_endpoint(
85
+ EndpointName=endpoint_name,
86
+ ContentType='application/json',
87
+ Body=json.dumps(payload).encode('utf-8'),
88
+ )
89
+ response = response["Body"].read().decode("utf8")
90
+ response = json.loads(response)
91
+ print(response[0]['generated_text'])
92
+
93
  ```
94
 
95
+ ```json
96
  {
97
  "body": [
98
  {