Spaces:
Sleeping
Sleeping
jj
Browse files- app.py +34 -0
- flagged/log.csv +3 -0
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sagemaker
|
2 |
+
import boto3
|
3 |
+
from sagemaker.huggingface import HuggingFaceModel
|
4 |
+
|
5 |
+
try:
|
6 |
+
role = sagemaker.get_execution_role()
|
7 |
+
except ValueError:
|
8 |
+
iam = boto3.client('iam')
|
9 |
+
role = iam.get_role(RoleName='sagemaker_execution_role')['Role']['Arn']
|
10 |
+
|
11 |
+
# Hub Model configuration. https://huggingface.co/models
|
12 |
+
hub = {
|
13 |
+
'HF_MODEL_ID':'microsoft/speecht5_tts',
|
14 |
+
'HF_TASK':'text-to-speech'
|
15 |
+
}
|
16 |
+
|
17 |
+
# create Hugging Face Model Class
|
18 |
+
huggingface_model = HuggingFaceModel(
|
19 |
+
transformers_version='4.26.0',
|
20 |
+
pytorch_version='1.13.1',
|
21 |
+
py_version='py39',
|
22 |
+
env=hub,
|
23 |
+
role=role,
|
24 |
+
)
|
25 |
+
|
26 |
+
# deploy model to SageMaker Inference
|
27 |
+
predictor = huggingface_model.deploy(
|
28 |
+
initial_instance_count=1, # number of instances
|
29 |
+
instance_type='ml.m5.xlarge' # ec2 instance type
|
30 |
+
)
|
31 |
+
|
32 |
+
predictor.predict({
|
33 |
+
"inputs": "The answer to the universe is 42",
|
34 |
+
})
|
flagged/log.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
Enter code to translate,"Source Language (e.g., English)","Target Language (e.g., German)",Translated Code,flag,username,timestamp
|
2 |
+
print(),Python,C++,,,,2023-08-15 15:15:41.981106
|
3 |
+
"print(""hellow world"")",python,C++,"convert the below python code to C++ code: print(""hellow world""), and then start with the r = n - s - d. in essence, the number of letters has to be a key, like a combination of two",,,2023-08-15 16:57:35.034180
|