Spaces:
Running
Running
Commit ·
d2acf3e
1
Parent(s): c215c18
Added dockerfile for space"
Browse files- .gitignore +1 -0
- 01_main.ipynb +12 -4
- Dockerfile +14 -0
- Makefile +19 -0
- _quarto.yml +1 -1
- contactdb.json +1 -1
.gitignore
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
/.quarto/
|
|
|
|
|
|
| 1 |
/.quarto/
|
| 2 |
+
.env
|
01_main.ipynb
CHANGED
|
@@ -19,20 +19,28 @@
|
|
| 19 |
},
|
| 20 |
{
|
| 21 |
"cell_type": "code",
|
| 22 |
-
"execution_count":
|
| 23 |
"metadata": {},
|
| 24 |
"outputs": [],
|
| 25 |
"source": [
|
| 26 |
"#|export\n",
|
| 27 |
"import pandas as pd\n",
|
| 28 |
-
"from flask import Flask, redirect, request, render_template
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"from IPython.display import display_html"
|
| 31 |
]
|
| 32 |
},
|
| 33 |
{
|
| 34 |
"cell_type": "code",
|
| 35 |
-
"execution_count":
|
| 36 |
"metadata": {},
|
| 37 |
"outputs": [],
|
| 38 |
"source": [
|
|
|
|
| 19 |
},
|
| 20 |
{
|
| 21 |
"cell_type": "code",
|
| 22 |
+
"execution_count": 25,
|
| 23 |
"metadata": {},
|
| 24 |
"outputs": [],
|
| 25 |
"source": [
|
| 26 |
"#|export\n",
|
| 27 |
"import pandas as pd\n",
|
| 28 |
+
"from flask import Flask, redirect, request, render_template"
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"cell_type": "code",
|
| 33 |
+
"execution_count": 26,
|
| 34 |
+
"metadata": {},
|
| 35 |
+
"outputs": [],
|
| 36 |
+
"source": [
|
| 37 |
+
"\n",
|
| 38 |
"from IPython.display import display_html"
|
| 39 |
]
|
| 40 |
},
|
| 41 |
{
|
| 42 |
"cell_type": "code",
|
| 43 |
+
"execution_count": 27,
|
| 44 |
"metadata": {},
|
| 45 |
"outputs": [],
|
| 46 |
"source": [
|
Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# The two following lines are requirements for the Dev Mode to be functional
|
| 4 |
+
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 9 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 10 |
+
|
| 11 |
+
COPY --chown=user . /app
|
| 12 |
+
ENV FLASK_APP=main.py
|
| 13 |
+
ENV FLASK_RUN_HOST=0.0.0.0
|
| 14 |
+
CMD ["flask", "run"]
|
Makefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.ONESHELL:
|
| 2 |
+
SHELL := /bin/bash
|
| 3 |
+
|
| 4 |
+
ENV := $(PWD)/.env
|
| 5 |
+
|
| 6 |
+
# Environment variables for project
|
| 7 |
+
include $(ENV)
|
| 8 |
+
|
| 9 |
+
# Export all variable to sub-make
|
| 10 |
+
export
|
| 11 |
+
|
| 12 |
+
dockerimg:
|
| 13 |
+
docker build -t htmxapp .
|
| 14 |
+
|
| 15 |
+
runapp:
|
| 16 |
+
docker run -p 5000:5000 -it htmxapp
|
| 17 |
+
|
| 18 |
+
deploy-space:
|
| 19 |
+
git push --force space main
|
_quarto.yml
CHANGED
|
@@ -24,7 +24,7 @@ website:
|
|
| 24 |
sidebar:
|
| 25 |
- id: API
|
| 26 |
title: API
|
| 27 |
-
style:
|
| 28 |
contents:
|
| 29 |
- 01_main.ipynb
|
| 30 |
|
|
|
|
| 24 |
sidebar:
|
| 25 |
- id: API
|
| 26 |
title: API
|
| 27 |
+
style: docked
|
| 28 |
contents:
|
| 29 |
- 01_main.ipynb
|
| 30 |
|
contactdb.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
[{"firstname":"
|
|
|
|
| 1 |
+
[{"firstname":"John","lastname":"Doe","phone":"555-1234","email":"john.doe@example.com","id":0},{"firstname":"Jane","lastname":"Smith","phone":"555-5678","email":"jane.smith@example.com","id":1},{"firstname":"Alice","lastname":"Johnson","phone":"555-8765","email":"alice.johnson@example.com","id":2},{"firstname":"Bob","lastname":"Williams","phone":"555-4321","email":"bob.williams@example.com","id":3},{"firstname":"Charlie","lastname":"Brown","phone":"555-9876","email":"charlie.brown@example.com","id":4},{"firstname":"Diana","lastname":"Miller","phone":"555-6543","email":"diana.miller@example.com","id":5},{"firstname":"Edward","lastname":"Davis","phone":"555-3456","email":"edward.davis@example.com","id":6},{"firstname":"Fiona","lastname":"Garcia","phone":"555-6789","email":"fiona.garcia@example.com","id":7},{"firstname":"George","lastname":"Martinez","phone":"555-7890","email":"george.martinez@example.com","id":8},{"firstname":"Hannah","lastname":"Rodriguez","phone":"555-8901","email":"hannah.rodriguez@example.com","id":9}]
|