Skip to content

Commit

Permalink
Merge pull request #6 from djliden/dl/fasthtml_section
Browse files Browse the repository at this point in the history
resolves issues adding fasthtml section
  • Loading branch information
djliden authored Sep 12, 2024
2 parents d0a5dc7 + 819604d commit 946eff4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion notebooks/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ execute:

# Information about where the book exists on the web
repository:
url: https://github.com/djliden/fine-tuning
url: https://github.com/djliden/notebooks
path_to_book: ./notebooks/ # Optional path to your book, relative to the repository root
branch: main # Which branch of the repository should be used when creating links (optional)

Expand Down
6 changes: 3 additions & 3 deletions notebooks/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
format: jb-book
root: index
parts:
- caption: AI Training
- caption: "AI Training"
chapters:
- file: ai_training/intro
sections:
Expand All @@ -16,9 +16,9 @@ parts:
- file: ai_training/appendix
sections:
- file: ai_training/fine_tuning/3_tinyllama_instruction_tune/data_preprocessing
- caption: FastHTML
- caption: "Web Development"
chapters:
- file: web_dev/FastHTML Tutorial
- file: web_dev/intro
sections:
- file: web_dev/fasthtml/1_introduction
- file: web_dev/fasthtml/2_styling
Expand Down
4 changes: 2 additions & 2 deletions notebooks/web_dev/fasthtml/1_introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"\n",
"FastHTML is a bit different from other web development frameworks insofar as you can write Python functions to handle server logic without having to write a separate HTML template and Javascript for client-side interactivity. This is because FastHTML is designed to be a Pythonic way to generate HTML content, and it uses htmx for client-side interactivity. This approach is somewhat controversial, as exemplified by this Hacker News exchange with the creator of FastHTML:\n",
"\n",
"![Hacker News exchange with FastHTML creator](./images/jh_soc_hn.png)\n",
"![Hacker News exchange with FastHTML creator](./jh_soc_hn.png)\n",
"\n",
"The key thing to remember here is that we return HTML content directly from our Python functions rather than populating a template and then rendering it.\n",
"\n",
Expand Down Expand Up @@ -43,7 +43,7 @@
"source": [
"To see the results, save this as a `.py` file and run it with `python <filename>.py`. You can save a cell as a file with the `%%writefile <filename>.py` magic command. There are a few things happening here that are immediately worth pointing out:\n",
"1. The `@rt(\"/\")` decorator tells us the *route* with which the decorated function will be associated. `/` is just the index page or main page.\n",
"2. `get()` isn't just an arbitrary function name—it is an HTTP verb or [HTTP request method](hhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Methods). HTTP methods specify the type of action to be performed; `get` means that we want to retrieve some data. Note that FastHTML gives a few different ways of specifying routes and methods. We could have decorated a differently-named function with `@app.get(\"/\")`. The following cell does the same thing; replace `app.py` with its contents and run it again to see."
"2. `get()` isn't just an arbitrary function name—it is an HTTP verb or [HTTP request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods). HTTP methods specify the type of action to be performed; `get` means that we want to retrieve some data. Note that FastHTML gives a few different ways of specifying routes and methods. We could have decorated a differently-named function with `@app.get(\"/\")`. The following cell does the same thing; replace `app.py` with its contents and run it again to see."
]
},
{
Expand Down
Binary file added notebooks/web_dev/fasthtml/jh_soc_hn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion notebooks/web_dev/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Web Development
# FastHTML

I am not a web developer by any stretch of the imagination. However, I have found that having some basic ability to build working sites and web applications, even if rough around the edges, is extremely useful. It makes it much easier to share my work and to prototype applications using LLMs. The latter point is especially important, as I have found that the *interface* to an LLM applications is often at least as important as the model itself.

Expand Down

0 comments on commit 946eff4

Please sign in to comment.