Getting User Utterance as Text in Amazon Sumerian - amazon-sumerian

I have a Sumerian Host that acts basically as a front-end for a Lex chatbot.
However, in some cases, I need to to some processing based on the actual user utterance (that is, the text of what the user says). Is there a way I can use "Send Audio to Lex" action (or a different one) to get a text version of the user audio (so, to perform speech-to-text)?

Related

Amazon QuickSight embedded dashboard - how to cache user session in my webapp (billing and timing concern)

I have embedded Amazon QuickSight dashboard in my web application by using amazon-quicksight-embedding-sdk (followed https://learnquicksight.workshop.aws/en/dashboard-embedding.html).
The user session seems to last many hours as mentioned in https://docs.aws.amazon.com/quicksight/latest/APIReference/API_GetDashboardEmbedUrl.html
When I requested the embed URL directly from my web browser, I could see that it was valid for many hours.
But my web app will request a new embed URL when user restarts it (by closing/reopening tab/browser). Does that mean a new user session was created and billed.
Is it possible to store the embed URL and to reuse it (as long as the user session lasts) for the case the same user closes the tab/browser and open the web app and the dashboard again (of course in the same browser)?
I tried to store the embedURL as a cookies named "embed_url". But calling amazon-quicksight-embedding-sdk.embedDashboard({url: embed_url}) resulted in
"Embedding failed because of invalid URL or authorization code. Both
of these must be valid and the authorization code must not be expired
for embedding to work."
I was sure the embed_url was still valid because requesting it by the browser directly worked.
Which "authorization code" is mentioned in the above error message? What did I miss or is it actually not possible?
Beside the billing concern, I've noticed that the call to get the embedURL took time (more than 5 seconds, eu-central-1) while the embedding took less (3 seconds). I thought I could improve the dashboard loading time by reusing the gotten embedURL. Any comments about the timing? Is it normal or did I do something wrong so that it was so slow? My test dashboard has only 1 diagram with unchanged dataset.
As per the Quicksight Pricing Page, if you're creating an embedded dashboard for a Quicksight "Reader", then you're paying $0.30/session per 30-minute logged-in-session for this Reader.
The validity of the session can be set in the SessionLifetimeInMinutes parameter of the GetDashboardEmbedUrl API, and has an upper bound of 600 minutes (10 hours).
As an example, suppose you set SessionLifetimeInMinutes to 600 mins for your Reader user. Also suppose that this user stayed logged in and uses the dashboard for 10 hours continuously, then that would equate to 20 sessions of usage (since the billing is in increments of 30-min chunks). At first glance it would seem that this would cause $0.30/session * 20 session-chunks = $6 to be billed.
However, as per the pricing page, there is an upper bound of $5.00 per month for every Reader. Which means that this Reader can never exceed $5 per month regardless of how many Quicksight sessions (of whatever duration) are created for them. So no matter how many times you call the GetDashboardEmbedUrl API for a given Reader, you're capped to $5/month for this user.
Also of use as to what constitutes a Reader session (from the pricing page):
When does a Reader Session start and end?
A Reader Session starts with user-initiated action (e.g., login, dashboard load, page refresh, drill-down or filtering) and runs for next 30-minutes.
Keeping Amazon QuickSight open in a background browser window/tab does not result in active sessions until the Reader initiates action on page.
But my web app will request a new embed URL when user restarts it (by closing/reopening tab/browser). Does that mean a new user session was created and billed.
I'm not 100% sure about this, but yes I believe a refresh (or open/close) of the tab results in a new session for the same user.
A Reader Session starts with user-initiated action (e.g., login, dashboard load, page refresh, drill-down or filtering) and runs for next 30-minutes.
The above excerpt is from the pricing page. So it does seem that page refresh (and thus another call to GetDashboardEmbedUrl) will trigger a new session for the user.
Which "authorization code" is mentioned in the above error message?
The GetEmbedDashboardUrl API response is a JSON object that looks like this:
{
"Status": 200,
"EmbedUrl": "https://us-east-1.quicksight.aws.amazon.com/embed/f4147cd0d4d_BLAH_BLAH_...",
"RequestId": "c15a7bad-629e-444a-b643-ff3142c9ae41"
}
If you look closer at the EmbedUrl, apart from the dashboard url itself, there are also these query-string parameters:
isauthcode
code
identityprovider
statePersistenceEnabled
potentially: other params too
The code parameter (embedded within the embedUrl) is the "authorization code" that you asked about.
Is it possible to store the embed URL and to reuse it (as long as the user session lasts) for the case the same user closes the tab/browser and open the web app and the dashboard again (of course in the same browser)?
No, that can't be done. As it says in the link you shared:
The following rules apply to the combination of URL and authorization code:
- They must be used together.
- They can be used one time only.
- They are valid for 5 minutes after you run this command.
So the embedURL and its associated auth code can only be used once together. Makes sense since this will prevent MITM replay attacks among other scenarios. Also I actually tried to cache the response and then re-use the embedUrl in case of a cache-hit, since this would improve the end-user experience. But this didn't work - a "replay" of the embedUrl is blocked by QuickSight, as mentioned in their doc.
Any comments about the timing?
This has been our experience also. The GetDashboardEmbedUrl REST API takes around 5-7 seconds (us-east-1) for our app and then the actual embedding takes another 3-5 seconds. Not great, but I don't see a way around this poor user experience as of now.

How to read a PDF file using Amazon Polly?

In a AWS blog (second line of first paragraph), it's mentioned that we can convert the text in a pdf document to speech.
I tried to find the documentation related to pdf reading, but still not able to get any solution.
Might Help you:
After logging on to the Amazon Polly console, choose Get started, and then choose the Text-toSpeech tab.
Choose the Plain text tab.
Type or paste this text into the input box.
Hi.
How are you,
I am testing this service.
For Choose a language and region, choose English US, then choose the voice you want to use for
this text.
To listen to the speech immediately, choose Listen to speech.
To save the speech to a file, do one of the following:
a. Choose Save speech to MP3.
b. To change to a different file format, choose Change file format, choose the file format you
want, and then choose Change
More details click here

How to create generic ics file which works for gmail, yahoo, outlook and other clients, while send from programming application?

I have web application based on django framework. Application creates ICS file by cal python package. We are sending this ICS to differnt clients email ID(gmail, outlook, yahoo etc)
So I am facing problem in below Scenarios
Scenario -
1. Create Event
2. Update all Occurrences or update particular occurrence of event
3. Cancel all Occurrences or cancel particular occurrence of event.
Create -
ICS file is working with Gmail and outlook but not with yahoo when i send this from web application, and if I send the same file from other clients like gmail it creates event in yahoo also.
Update -
Same scenario is applicable for update case. Not working with yahoo.
Cancel -
In cancel case ICS is not working for any client.
I have few point in Cancel file like -
METHOD : CANCEL
UID : Same as sent in create and update case.
Above two are mandatory fields
STATUS, SEQUENCE, RRULE - Is this required?
If SEQUENCE is required then what will be the value of this variable.
Please give your suggestions.
Summary of Answers:
add file header with contents-type = text/calendar.
Validate all ics files and fix the errors such blank lines, line endings etc
For the final cancel of a single instance within a recurring series not working in Yahoo, via email it sounds like Hemendra is issuing a "STATUS:CANCELLED" with the RECURRENCE-ID for the date to be removed. This maybe working with some applications however some may expect the formal way to remove an instance of a date in a series, which is to reissue the event series (RRULE) with the sequence number updated and including the date one wants to exclude as an EXDATE. "The EXDATE property is used to remove instances from a recurrence set defined by an RRULE." https://devguide.calconnect.org/Recurrences/
See also
https://icalendar.org/iCalendar-RFC-5545/3-8-5-1-exception-date-times.html,
icalendar remove an instance from recurrence
What is the correct ics file for editing only one occurrence from the series
Some cautions on EXDATE FORMATS to match
EXDATE recurrence setting being ignored

Can we use Amazon Lex service only for speech to text and pass the text input to our lambda function?

Can we use Amazon Lex just to convert text from voice and pass the text input to our lambda function?
I want to capture the whole user speech and get it converted into text and further, want to process that text in my lambda function.
The answer really depends on how much speech you intend to collect from Lex to pass over to Lambda. If you want to send full recordings of speech to be converted into text, I would recommend looking at the Amazon Transcribe service first.
If you are looking to just collect simple speech, you can configure an intent in Lex to match an utterance. Then prompt the user for additional speech information using slots as seen below. This example has a prompt asking for the user's name and then inserts it into a slot called "Name".
From there, just setup the Fulfillment on the Intent to point to your Lambda function as seen below where I pass this information to a Lambda function called "LEX_CollectSpeech".
You can find the Lambda documentation that outlines the expected input from Lex and Response formats here. https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html

User likes on django accumulation

I have a simple pinterest clone app built and have a basic activity stream setup.
The activity stream only records when a new image is created, when an image is liked, when a new user is created, or when a followed user follows another user.
What I would like to implement and do not know how is accumulation, for example if 2 or more user like a certain image, I would prefer the activity stream to say:
"User 1 and User 2 like image"
Can any one help me achieve this?
The Action models in django-activity-stream could be helpful.
For example, when an Actor performs an action, you could look up if there was recently a similar Verb and Target combination by a different Actor, and then replace that earlier instance with a new one that includes the most recent Actor.