forked from quiccklabs/Labs_solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomate Interactions with Contact Center AI: Challenge Lab
101 lines (45 loc) · 3.08 KB
/
Automate Interactions with Contact Center AI: Challenge Lab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
****************Automate Interactions with Contact Center AI: Challenge Lab******************************
-------------------------------------step 1-----------------------------
Task 1: Create a Cloud Storage Bucket
gsutil mb -l Region_name gs://[project id]/
-------------------------------------step 2——————————————
Task 2: Create a Cloud Function
Go to the “saf-longrun-job-func” directory
cd dataflow-contact-center-speech-analysis/saf-longrun-job-func
gcloud functions deploy safLongRunJobFunc --runtime nodejs12 --trigger-resource [project id] --region Region_name --trigger-event google.storage.object.finalize
-------------------------------------step 3——————————————
Task 3: Create a BigQuery Dataset and Table
# To create the dataset
bq mk dataset_name
-------------------------------------step4-----------------------------
Task 4: Create Cloud Pub/Sub Topic
gcloud pubsub topics create [Topic_Name]
-------------------------------------step 5——————————————
Task 5: Create a Cloud Storage Bucket for Staging Contents
gsutil mb -l [Region_name] gs://[BUCKET_NAME]/
Create a folder “DFaudio” in the bucket
Need to do it manually
-------------------------------------step 6——————————————
Task 6: Deploy a Cloud Dataflow Pipeline
Go to the saf-longrun-job-dataflow directory
python -m virtualenv env -p python3
source env/bin/activate
pip install apache-beam[gcp]
pip install dateparser
Now, execute the command given below:
python saflongrunjobdataflow.py \
--project=[PROJECT_ID] \
--region=Region_name \
--input_topic=projects/[PROJECT_ID]/topics/[Topic_Name] \
--runner=DataflowRunner \
--temp_location=gs://[BUCKET_NAME]/[FOLDER] \
--output_bigquery=[PROJECT_ID]:dataset_name.transcripts \
--requirements_file=requirements.txt
-------------------------------------step 7——————————————
Task 7: Upload Sample Audio Files for Processing
gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:false -h x-goog-meta-pubsubtopicname:[TOPIC_NAME] -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_mono.flac gs://[BUCKKET_NAME]
gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:true -h x-goog-meta-pubsubtopicname:[TOPIC_NAME] -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_stereo.wav gs://[BUCKET_NAME]
After performing Task 7: Upload Sample Audio Files for Processing, we have to wait....until we see output in bigquery > dataset > table.
Task 8: Run a Data Loss Prevention Job
select * from (SELECT entities.name,entities.type, COUNT(entities.name) AS count FROM dataset_name.transcripts, UNNEST(entities) entities GROUP BY entities.name, entities.type ORDER BY count ASC ) Where count > 5
—-----------------------------—-----------------END—----------------------------—-----------------------------