Submit an App by Url to Firefox Marketplace - marketplace

I can install it with URL, but i can't upload to firefox marketplace.
but i have 2 errors:
JSON Parse Error
Error: The webapp extension could not be parsed due to a syntax error in the JSON.
No JSON object could be decoded: line 1 column 0 (char 0)
well the json is this:
{
"name": "Snake",
"description": "Snake in html and js",
"launch_path": "/index.html",
"developer": {
"name": "ZiTAL",
"url": "https://github.com/ZiTAL/snakejs"
},
"icons": {
"128": "/img/snake-128.png"
},
"installs_allowed_from": ["*"]
}
Second error:
Manifests must be served with the HTTP header "Content-Type: application/x-web-app-manifest+json". See https://developer.mozilla.org/docs/Web/Apps/Manifest#Serving_manifests for more information.
well if i downloaded with wget:
wget http://myurl/manifest.webapp
the header is OK
HTTP eskaera bidalia, erantzunaren zain... 200 OK
Luzera: 267 [application/x-web-app-manifest+json]
Saving to: ‘manifest.webapp’

To validate the app, you need to put the manifest.webapp url, not the app url:
http://myurl/manifest.webapp

Second error:
You could try wget --save-headers and look in the output file, if the Content-Type header is really correct...

Related

AWS sagemaker endpoint received client (400) error

I've deployed a tensorflow multi-label classification model using a sagemaker endpoint as follows:
predictor = sagemaker_model.deploy(initial_instance_count=1, instance_type="ml.m5.2xlarge", endpoint_name='testing-2')
It gets deployed and works fine when I invoke it from the Sagemaker Jupyter instance:
sample = ['this movie was extremely good']
output=predictor.predict(sample)
output:
{'predictions': [[0.00370046496,
4.32942124e-06,
0.00080883503,
9.25126587e-05,
0.00023958087,
0.000130862]]}
However, I am unable to send a request to the deployed endpoint from other notebooks or sagemaker studio. I'm unsure of the request format.
I've tried several variations in the input format and still failed. The error message is as below:
sagemaker error
Request:
{
"body": {
"text": "Testing model's prediction on this text"
},
"contentType": "application/json",
"endpointName": "testing-2",
"customURL": "",
"customHeaders": [
{
"Key": "sm_endpoint_name",
"Value": "testing-2"
}
]
}
Error:
Error invoking endpoint: Received client error (400) from primary with message "{ "error": "Failed to process element:
0 key: text of 'instances' list. Error: INVALID_ARGUMENT: JSON object: does not have named input: text" }".
See https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEventViewer:group=/aws/sagemaker/Endpoints/testing-2
in account 793433463428 for more information.
Is there any way to find out exactly how the model expects the request format to be?
Earlier I had the same model on my local system and the way I tested it was using this curl request:
curl -s -H 'Content-Type: application/json' -d '{"text": "what ugly posts"}' http://localhost:7070/sentiment
And it worked fine without any issues.
I've tried different formats and replaced the "text" key inside body with other words like "input", "body", nothing etc.
Based on your description above, I assume you are deploying the TensorFlow model using the SageMaker TensorFlow container.
If you want to view what your model expects as input you can use the saved_model CLI:
1
├── keras_metadata.pb
├── saved_model.pb
└── variables
├── variables.data-00000-of-00001
└── variables.index
!saved_model_cli show --all --dir {"1"}
After you have confirmed the input name above you can invoke the endpoint as follows:
import json
import boto3
client = boto3.client('runtime.sagemaker')
data = {"instances": ['this movie was extremely good']}
response = client.invoke_endpoint(EndpointName=<EndpointName>,
Body=json.dumps(data))
response_body = response['Body']
print(response_body.read())
The same payload can then also be used in Studio when invoking the endpoint.

Google Cloud Speech API longrunningrecognize only returns name

I'm trying to convert over an hour audio data to text using Google Cloud Speech API, and I'm using API explorer since it's easy.
The request looks like this.
POST https://speech.googleapis.com/v1/speech:longrunningrecognize?key={YOUR_API_KEY}
{
"audio": {
"uri": "gs://data/audio.flac"
},
"config": {
"encoding": "FLAC",
"languageCode": "en-US"
}
}
The response look like this.
200
Show headers
{
"name": "`numbers`"
}
How come it is only returning the name, and not returning the text of the audio?
Just had the same problem.
Found the answer on https://cloud.google.com/speech/docs/async-recognize
If the request is successful, the server returns a 200 OK HTTP status code and the response in JSON format:
{
"name": "5543203840552489181"
}
where name is the name of the long running operation created for the request.
Wait approximately 30 seconds for processing to complete. To retrieve the result of the operation, make a GET request:
GET https://speech.googleapis.com/v1/operations/YOUR_OPERATION_NAME?key=YOUR_API_KEY
Got my results with:
curl -s -k -H "Content-Type: application/json" \
-H "Authorization: Bearer {access_token}" \
https://speech.googleapis.com/v1/operations/{name}

google speech api Invalid recognition

I am trying to follow the example on google speech api found here
https://cloud.google.com/speech/docs/getting-started
1) I created the follow json request file
{
'config': {
'encoding':'FLAC',
'sampleRate': 16000,
'languageCode': 'en-US'
},
'audio': {
'uri':'gs://cloud-samples-tests/speech/brooklyn.flac'
}
}
2) Authenticate to my service account
gcloud auth activate-service-account --key-file=service-account-key-file
3) Obtain my authorization token successfully
gcloud auth print-access-token
access_token
4) Then use the following curl command
curl -s -k -H "Content-Type: application/json" \
-H "Authorization: Bearer access_token" \
https://speech.googleapis.com/v1beta1/speech:syncrecognize \
-d #sync-request.json
But I keep getting the following response
{
"error": {
"code": 400,
"message": "Invalid recognition 'config': bad encoding..",
"status": "INVALID_ARGUMENT"
}
}
Do I need access permissions for the uri gs://cloud-samples-tests/speech/brooklyn.flac? Is that what the problem is?
Thanks in advance..
In my opinion, it is a file format issue.
You have to send WAV file instead of FLAC ...
[ FLAC and MP3 format are not supported <=> need a file conversion (representing cost) on the server side ]
Convert your audio file to WAV (using ffmpeg or avconv), then retry.
You may also take a look here (to see a working example)
For me, the solution was to remove the space between "-d #",
so change "-d #sync-request.json" to "-d#sync-request.json".
I got help here: https://groups.google.com/forum/#!topic/cloud-speech-discuss/bL_N5aJDG5A. Apparently the file was being read and processed, but the parms were going to the "curl.exe" instead of being passed to the URL.
I understand this is quite late for an answer. However, it might help others so putting in your error.
The config that you are passing is actually incorrect. The attributes should be like:
{
"config": {
"encoding": "LINEAR16",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"maxAlternatives": 1,
"profanityFilter": true,
"enableWordTimeOffsets": false
},
"uri": {
"content":"<your uri>"
}
}

Unable to Post a csv file in Postman, getting 400 error

I am trying to post a csv file and get the fields(fields in the csv file) in the response using Postman but I am getting 400 Bad request error.
Error:
{
"status": 400,
"error": "Bad Request",
"message": "Required request part 'inFile' is not present",
"timeStamp": "Tue Feb 07 00:00:17 EST 2017",
"trace": "org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'inFile' is not present\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver.resolveArgument(RequestPartMethodArgumentResolver.java:192)\n\tat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite....}
Please let me know how to overcome this issue as I am new to this.
You forgot to give a name to your form-data parameter.
According to the error you got the name of the key should be "inFile".
And you need to input it here:

django rest framework post - Invalid drive specification

I'm trying to post an XML to my API and although it works fine from the URL if I try to CURL the XML file in I get an "Invalid drive specification" error.
This is my CURL command -
curl -X POST -d 5022_4qa.xml http://servername:9001/deploy/calendar/&format=xml
As soon as I try the curl I get back a few errors before it fails. My assumption is that it's not grabbing the XML file for some reason. I can even put the full path of the file the error is the same.
....
</div>{
"evntmst_type": [
"This field is required."
],
"evntmst_id": [
"This field is required."
],
"evntmst_name": [
"This field is required."
]
}</pre>
....
Invalid drive specification
In the return on the API side it's returning a 400 code.
To post the contents of a file with curl, you need to prefix the file name with #. So:
curl -X POST -d #5022_4qa.xml http...