Skip to content

Commit 7317730

Browse files
author
Jim Bennett
committed
More updates based on reviewing the code
1 parent 018f88b commit 7317730

File tree

4 files changed

+13
-26
lines changed

4 files changed

+13
-26
lines changed

Events and Hacks/Student Hacks/mood-detector-workshop/Steps/AnalyseThePhotoUsingAI.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ The `emotion` value on the document is set to the most likely emotion using the
234234

235235
## Next step
236236

237-
In this step you analyzed the image for faces using AI, checking each face for emotion. In the [next step](./SaveTheResultsToADatabase.md) you will save the results of the analysis into a database.
237+
In this step you analyzed the image for faces using AI, checking each face for emotion. In the [next step](./SaveTheResultsToADatabase.md) you will create a Cosmos DB collection, and save the results of the analysis into this collection.

Events and Hacks/Student Hacks/mood-detector-workshop/Steps/ReturnTheEmotionCount.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Return the count of each emotion from the Web Api
22

3-
In the [previous step](./SaveTheResultsToADatabase.md) you created a Cosmos DB collection, and saved the results of the analysis into a database. In this step you will return the count of each emotion from this Web Api.
3+
In the [previous step](./SaveTheResultsToADatabase.md) you created a Cosmos DB collection, and saved the results of the analysis into this collection. In this step you will return the count of each emotion from this Web Api.
44

55
## Extracting and manipulating the data
66

Events and Hacks/Student Hacks/mood-detector-workshop/Steps/SaveTheResultsToADatabase.md

+2-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Save the face details to a database
22

3-
In the [previous step](./AnalyseThePhotoUsingAI.md) you analyzed the image for faces using AI, checking each face for emotion. In this step you will save the results of the analysis into a database.
3+
In the [previous step](./AnalyseThePhotoUsingAI.md) you analyzed the image for faces using AI, checking each face for emotion. In this step you will create a Cosmos DB collection, and save the results of the analysis into this collection.
44

55
## Cosmos DB account
66

@@ -114,26 +114,6 @@ There is a Cosmos DB client available as a Python package.
114114
115115
* Save the file
116116
117-
## Deploy the code
118-
119-
* Open the command palette:
120-
* On Windows, press Ctrl+Shift+P
121-
* On MacOS, press Cmd+Shift+P
122-
123-
* Select *Azure App Service: Deploy to Web App...*
124-
125-
![The command palette showing the Azure App Service: Deploy to Web App option](../Images/CommandPaletteDeployAppService.png)
126-
127-
* A dialog will pop up asking if you want to overwrite the existing deployment. Select the **Deploy** button.
128-
129-
![The overwrite existing deploy dialog](../Images/OverwriteDeploy.png)
130-
131-
* A popup will appear showing the deployment progress. You can monitor the progress from the *Output* window by selecting *View -> Output* and selecting *Azure App Service* from the window selector.
132-
133-
![The deploy progress dialog](../Images/DeployProgress.png)
134-
135-
* Open the web site in your browser to verify that everything is working correctly.
136-
137117
## What does this code do
138118
139119
The overall flow of this code is:
@@ -177,4 +157,4 @@ The `doc` object contains the face information, and it is inserted into the coll
177157
178158
## Next steps
179159
180-
In this step you created a Cosmos DB collection, and saved the results of the analysis into a database. In the [next step](./ReturnTheEmotionCount.md) you will return the count of each emotion from this Web Api.
160+
In this step you created a Cosmos DB collection, and saved the results of the analysis into this collection. In the [next step](./ReturnTheEmotionCount.md) you will return the count of each emotion from this Web Api.

Events and Hacks/Student Hacks/mood-detector-workshop/Steps/ViewTheResults.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Templates live in a folder called `templates`.
3232
<body>
3333
<table border = 1>
3434
<tr>
35-
<td>Emotion</td>
35+
<th>Emotion</th>
3636
</tr>
3737
{% for row in result %}
3838
<tr>
@@ -51,7 +51,7 @@ Templates live in a folder called `templates`.
5151
* At the start of the file import the `render_template` member from the flask module by adding it to the existing import statement
5252

5353
```python
54-
from flask import Flask, request, render_template
54+
from flask import Flask, request, jsonify, render_template
5555
```
5656

5757
* Replace the `home` function with the following code:
@@ -133,6 +133,13 @@ This is also template code. For each `row` in the `results`, this code outputs a
133133

134134
### The `app.py` file
135135

136+
```python
137+
from flask import Flask, request, jsonify, render_template
138+
```
139+
140+
This tells the Python compiler that we want to use code in the `render_template` module. This module was installed as part of the `flask` package.
141+
142+
136143
```python
137144
docs = list(client.ReadItems(cosmos_collection_link))
138145
```

0 commit comments

Comments
 (0)