-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zuckerco
authored and
zuckerco
committed
Apr 13, 2017
0 parents
commit df7f261
Showing
12 changed files
with
15,540 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
|
||
"intents": [{ | ||
|
||
"intent": "testIntent", | ||
|
||
"slots": [{ | ||
|
||
"name": "univ_name", | ||
|
||
"type": "AMAZON.EducationalOrganization" | ||
|
||
}] | ||
|
||
|
||
}, { | ||
|
||
"intent": "univSearchIntent", | ||
|
||
"slots": [{ | ||
|
||
"name": "first", | ||
|
||
"type": "AMAZON.NUMBER" | ||
|
||
}] | ||
|
||
}] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
testIntent {{univ_name}} | ||
testIntent Say {{univ_name}} |
Binary file not shown.
7,704 changes: 7,704 additions & 0 deletions
7,704
scorecard_files/Most-Recent-Cohorts-Scorecard-Elements.csv
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import logging | ||
from flask import Flask | ||
from flask_ask import Ask, statement, question, session | ||
from data import UNIVS | ||
|
||
app = Flask(__name__) | ||
|
||
ask = Ask(app, "/") | ||
|
||
logging.getLogger("flask_ask").setLevel(logging.DEBUG) | ||
|
||
def get_univ(source): | ||
univ_name = "University of Florida" | ||
for row in source: | ||
if univ_name == row["univ_name"]: | ||
univ_name = row["univ_name"] | ||
city_name = row["city_name"] | ||
state_name = row["state_name"] | ||
# row[" cost_to_attend "] needs to have the spaces around the variables because that's how it is the python dictionary sadly. Same for md_earnings. | ||
cost_to_attend = row[" cost_to_attend "] | ||
grad_rate = row["grad_rate"] | ||
md_earnings = row[" md_earnings "] | ||
|
||
return univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings | ||
# You need to get univ_name, city_name, state_name, cost_to_attend, grad_rate and md_earnings. | ||
|
||
test = get_univ(UNIVS) | ||
print test | ||
|
||
@ask.launch | ||
def start_skill(): | ||
welcome_message = 'Welcome to University Explorer. What university would you like to know about?' | ||
return question(welcome_message) | ||
|
||
@ask.intent(testIntent) | ||
def test_intent(): | ||
# Here you just want to pass what Alexa here's into a sentence. | ||
return statement('I heard you say {}.'.format(univ_name)) | ||
|
||
@ask.intent(univSearchIntent) | ||
def share_univs(): | ||
univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings = get_univ() | ||
univ_message = 'The {} is based in {}, {}. The average annual cost to attend is {}, the graduation rate is {} and the median salary after attending is {}.'.format(univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings) | ||
return statement(univ_message) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
|
||
app.run(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from flask import Flask | ||
from data import UNIVS | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
|
||
def get_univ(source): | ||
# univ_name in the following line is only meant to be temporary. The final prodouct will not be hardcoded and will instead take what the user says. | ||
univ_name = "University of Florida" | ||
for row in source: | ||
if univ_name == row["univ_name"]: | ||
univ_name = row["univ_name"] | ||
city_name = row["city_name"] | ||
state_name = row["state_name"] | ||
# row[" cost_to_attend "] needs to have the spaces around the variables because that's how it is the python dictionary sadly. Same for md_earnings. | ||
cost_to_attend = row[" cost_to_attend "] | ||
grad_rate = row["grad_rate"] | ||
md_earnings = row[" md_earnings "] | ||
|
||
return univ_name, city_name, state_name, cost_to_attend, grad_rate, md_earnings | ||
|
||
# I'm having issues in the following code block. When I try running it with the debugging stuff at the bottom I receive the error 'ValueError: View function did not return a response' from flask. | ||
# @app.route('/') | ||
# @app.route('/index.html') | ||
# def index(): | ||
# test = get_univ(UNIVS) | ||
# print test | ||
|
||
# With this standing after the above and below code blocks are commented out, I receive the desired response in Terminal: ('University of Florida', 'Gainesville', 'Florida', ' $11,778.00 ', '87%', ' $51,100.00 '). This shows that the function I have written works, but something I'm doing with flask doesn't. | ||
test = get_univ(UNIVS) | ||
print test | ||
|
||
|
||
# if __name__ == '__main__': | ||
# app.run(debug=True) |