Name: CognitiveConcierge
Owner: International Business Machines
Description: A swift iOS app for recommending the best local restaurants with a swift with kitura backend API
Created: 2016-10-13 04:32:03.0
Updated: 2018-05-19 13:59:15.0
Pushed: 2018-05-17 19:01:06.0
Homepage: https://developer.ibm.com/code/patterns/build-a-cognitive-recommendation-app-with-swift
Size: 27777
Language: Swift
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Watson Conversation is now Watson Assistant. Although some images in this code pattern may show the service as Watson Conversation, the steps and processes will still work.
CognitiveConcierge is an end-to-end Swift application sample with an iOS front end and a Kitura web framework back end. This application also demonstrates how to pull in a number of different Watson services to your Swift client and server side apps via the Watson Developer Cloud's Swift SDK, including Watson Assistant, Text to Speech, Speech to Text, and the Natural Language Understanding service.
The user deploys the server application to IBM Cloud.
The user interacts with the IOS application.
When the user performs any action, IOS application the server application API which uses the Watson services and Google Places API to provide the user recommendations.
If you haven't so yet, you also need to download and install the following:
Use the following steps to deploy the application
You can deploy the server application using any one of the following ways:
Clicking on the button below creates a IBM Cloud DevOps Toolchain and deploys this application to the IBM Cloud. The manifest.yml
file [included in the repo] is parsed to obtain the name of the application, configuration details, and the list of services that should be provisioned. For further details on the structure of the manifest.yml
file, see the Cloud Foundry documentation.
Once deployment to the IBM Cloud is completed, you can view the deployed application and services from your IBM Cloud account.
You can also manually deploy the Server Application to the IBM Cloud. Though not as magical as using the Bluemix button above, manually deploying the app gives you some insights about what is happening behind the scenes. Remember that you'd need the Bluemix command line installed on your system to deploy the app to the IBM Cloud.
Execute the following command to clone the Git repository:
clone https://github.com/IBM/CognitiveConcierge.git
Go to the project's root folder on your system and execute the Cloud-Scripts/services/services.sh
script to create the services CognitiveConcierge depends on. Please note that you should have logged on to the IBM Cloud before attempting to execute this script. For information on how to log in, see the IBM Cloud documentation.
Executing the Cloud-Scripts/services/services.sh
script:
Cloud-Scripts/services/services.sh
Before deploying your application to the cloud, you will need to update it with the google API Key. In the main.swift folder, update the struct value with your google API Key.
After the services are created and you've updated this file, you can issue the bx app push YOUR_APP_NAME
command from the project's root folder CognitiveConcierge
to deploy the server application to IBM Cloud.
Once the application is running on the IBM Cloud, you can access your application's assigned URL (i.e. route). To find the route, you can log on to your IBM Cloud account, or you can inspect the output from the execution of the bluemix app push
or bx app show <application name>
commands. The string value shown next to the urls
field contains the assigned route. Use that route as the URL to access the sample server using the browser of your choice.
app show CognitiveConcierge
king 'cf app CognitiveConcierge'...
ing health and status for app CognitiveConcierge in org ishan.gulhane@ibm.com / space dev as ishan.gulhane@ibm.com...
ested state: started
ances: 1/1
e: 512M x 1 instances
: cognitiveconcierge-lazarlike-archaizer.mybluemix.net
uploaded: Mon Jun 5 18:01:42 UTC 2017
k: cflinuxfs2
dpack: swift_buildpack
state since cpu memory disk details
running 2017-06-05 11:05:41 AM 0.3% 6.4M of 512M 269.8M of 1G
Resources/conversationWorkspace.json
. Make note of the workspace id for later use in running the iOS application.YourProjectName/CognitiveConcierge-iOS
folder and run the following command to install the necessary dependencies (This may take some time):hage update --platform iOS
install
Open the CognitiveConcierge.xcworkspace
file in Xcode 9.2 from your terminal using open CognitiveConcierge.xcworkspace
Update CognitiveConcierge.plist file: One way to persist data in Swift is through the property list or .plist file. You will need to open this file and add the credentials for all of the services that were created for you earlier, as well as the Google Places API Key mentioned in the Prerequisites section. You can find these services in the Bluemix dashboard. Click the service name you're interested in, and then click Service Credentials
. If there is no Credential created, click New Credential
.
Update bluemix.plist file:
isLocal
value to YES
if you'd like to use a locally running server; if you set the value to NO
, then you will be accessing the server instance running on the IBM Cloud.appRouteRemote
value, you should go to your application's page on the IBM Cloud. There, you will find a View App
button near the top right. Clicking on it should open up your app in a new tab, the url for this page is your route which maps to the appRouteRemote key in the plist. Make sure to include the http:// protocol
in your appRouteRemote
and to exclude a forward slash at the end of the url.bx app env CognitiveConcierge
where appRouteRemote is uris.
P_APPLICATION": {
lication_id": "3d06c0e7-1fff-4dbf-b0cb-b289770eccfe",
lication_name": "CognitiveConcierge",
lication_uris": [
nitiveconcierge-lazarlike-archaizer.mybluemix.net"
lication_version": "3ef63168-35f5-4517-84e9-e8f19c8f34b4",
its": {
k": 1024,
": 16384,
": 512
e": "CognitiveConcierge",
ce_id": "2b3083b9-7ef9-4d55-9741-34433be4cea1",
ce_name": "dev",
s": [
nitiveconcierge-lazarlike-archaizer.mybluemix.net"
rs": null,
sion": "3ef63168-35f5-4517-84e9-e8f19c8f34b4"
Running Environment Variable Groups: BLUEMIX_REGION: ibm:yp:us-south
Staging Environment Variable Groups: BLUEMIX_REGION: ibm:yp:us-south
Press the Play
button in Xcode to build and run the project in the simulator or on your iPhone!
Before building the CognitiveConcierge-Server application, first update the credentials in the config/nlu-creds file for local development.
You can then build the CognitiveConcierge-Server by going to the CognitiveConcierge-Server
directory of the cloned repository and running swift build
. To start the Kitura-based server for the CognitiveConcierge app on your local system, go to the CognitiveConcierge-Server
directory of the cloned repository and run .build/debug/CognitiveConcierge
. You should also update the bluemix.plist
and CognitiveConcierge.plist
file in the Xcode project in order to have the iOS app connect to this local server. See the Update configuration for iOS app section for details.
CognitiveConcierge.plist
and bluemix.plist
files.