Skip to content

Commit

Permalink
new(all): Removal of Azure Functions and migration to Flesk.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jul 13, 2021
1 parent 05e1466 commit 8e6543f
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 246 deletions.
5 changes: 0 additions & 5 deletions .funcignore

This file was deleted.

55 changes: 45 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand All @@ -47,8 +46,10 @@ htmlcov/
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -58,6 +59,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -70,6 +72,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -80,17 +83,23 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that dont work, or not
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py
Expand Down Expand Up @@ -122,9 +131,35 @@ dmypy.json
# Pyre type checker
.pyre/

# Azure Functions artifacts
bin
obj
appsettings.json
local.settings.json
.python_packages
# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
6 changes: 0 additions & 6 deletions .vscode/extensions.json

This file was deleted.

12 changes: 0 additions & 12 deletions .vscode/launch.json

This file was deleted.

9 changes: 2 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"azureFunctions.deploySubpath": ".",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.pythonVenv": ".venv",
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~3",
"debug.internalConsoleOptions": "neverOpen"
}
"python.pythonPath": "/usr/local/bin/python3"
}
26 changes: 0 additions & 26 deletions .vscode/tasks.json

This file was deleted.

51 changes: 0 additions & 51 deletions EstimateLoanTax/__init__.py

This file was deleted.

20 changes: 0 additions & 20 deletions EstimateLoanTax/function.json

This file was deleted.

3 changes: 0 additions & 3 deletions EstimateLoanTax/sample.dat

This file was deleted.

17 changes: 0 additions & 17 deletions EstimateLoanTaxTrain/__init__.py

This file was deleted.

20 changes: 0 additions & 20 deletions EstimateLoanTaxTrain/function.json

This file was deleted.

3 changes: 0 additions & 3 deletions EstimateLoanTaxTrain/sample.dat

This file was deleted.

20 changes: 0 additions & 20 deletions GeneralQA/function.json

This file was deleted.

19 changes: 1 addition & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
# BotModels

Models in Python for General Bots AI demands.

# Environment

1. Install Visual Studio Code (VSCode);
2. Install VSCode Extension: Azure Functions;
3. Install VSCode Extension: Azure Machine Learning;
4. Install NodeJS;
5. Run npm install -g azure-functions-core-tools@3 --unsafe-perm true.

# Libraries

- TensorFlow;
- SciKit-Learn;
- Pandas;
- NumPy.
This is sample Python Flask application.
29 changes: 20 additions & 9 deletions GeneralQA/__init__.py → app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@

predictor = None

def main(req: func.HttpRequest) -> func.HttpResponse:
from flask import Flask, render_template, request
import hmac

app = Flask(__name__)

@app.route("/query", methods=['POST'])
def index():
logging.info('General Bots QA.')

content = req.form.get('content')
question = req.params.get('question')

content = request.form.get('content')
question = request.args.get('question')
key = request.args.get('key')

if not hmac.compare_digest(key, 'starter'):
return 'Invalid key.'

global predictor
if predictor is None:
predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/transformer-qa-2020-10-03.tar.gz")
Expand All @@ -26,9 +36,10 @@ def main(req: func.HttpRequest) -> func.HttpResponse:


if answer:
return func.HttpResponse(answer)
return answer
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
return "No answers for this question."

if __name__ == '__main__':
app.run(debug=True)

15 changes: 0 additions & 15 deletions host.json

This file was deleted.

4 changes: 0 additions & 4 deletions proxies.json

This file was deleted.

Loading

0 comments on commit 8e6543f

Please sign in to comment.