key
stringclasses
5 values
id
stringlengths
13
150
text
stringlengths
68
54.2k
filetype
stringclasses
3 values
llms.txt
Docs: FastHTML quick start
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Docs: HTMX reference
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Docs: Surreal
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Docs: CSS Scope Inline
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Docs: Starlette quick guide
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
API: API List
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Examples: Websockets application
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Examples: Todo list application
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
llms.txt
Optional: Starlette full documentation
<project title="FastHTML" summary='FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore&#39;s `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additi...
xml
FastHTML Docs
index.html.md
# FastHTML <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> Welcome to the official FastHTML documentation. FastHTML is a new next-generation web framework for fast, scalable web applications with minimal, compact code. It’s designed to be: - Powerful and expressive enough to build the most advanced, in...
md
FastHTML Docs
api/cli.html.md
# Command Line Tools <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ------------------------------------------------------------------------ <a href="https://github.com/AnswerDotAI/fasthtml/blob/main/fasthtml/cli.py#L15" target="_blank" style="float:right; font-size:smaller">source</a> ### railway_lin...
md
FastHTML Docs
api/components.html.md
# Components <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ``` python from lxml import html as lx from pprint import pprint ``` ------------------------------------------------------------------------ <a href="https://github.com/AnswerDotAI/fasthtml/blob/main/fasthtml/components.py#L34" target="_blan...
md
FastHTML Docs
api/core.html.md
# Core <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> This is the source code to fasthtml. You won’t need to read this unless you want to understand how things are built behind the scenes, or need full details of a particular API. The notebook is converted to the Python module [fasthtml/core.py](https:/...
md
FastHTML Docs
api/fastapp.html.md
# fastapp <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> Usage can be summarized as: ``` python from fasthtml.common import * app, rt = fast_app() @rt('/') def get(): return Titled("A demo of fast_app()@") serve() ``` ------------------------------------------------------------------------ <a href...
md
FastHTML Docs
api/js.html.md
# Javascript examples <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> To expedite fast development, FastHTML comes with several built-in Javascript and formatting components. These are largely provided to demonstrate FastHTML JS patterns. There’s far too many JS libs for FastHTML to wrap them all, and as...
md
FastHTML Docs
api/oauth.html.md
# OAuth <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> This is not yet thoroughly tested. See the [docs page](https://docs.fastht.ml/explains/oauth.html) for an explanation of how to use this. ``` python from IPython.display import Markdown ``` ---------------------------------------------------------...
md
FastHTML Docs
api/pico.html.md
# Pico.css components <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> `picocondlink` is the class-conditional css `link` tag, and `picolink` is the regular tag. ``` python show(picocondlink) ``` <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@latest/css/pico.conditional.min.css"...
md
FastHTML Docs
api/svg.html.md
# SVG <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ``` python from nbdev.showdoc import show_doc ``` You can create SVGs directly from strings, for instance (as always, use `NotStr` or `Safe` to tell FastHTML to not escape the text): ``` python svg = '<svg width="50" height="50"><circle cx="20" cy="...
md
FastHTML Docs
api/xtend.html.md
# Component extensions <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ``` python from pprint import pprint ``` ------------------------------------------------------------------------ <a href="https://github.com/AnswerDotAI/fasthtml/blob/main/fasthtml/xtend.py#L25" target="_blank" style="float:right; ...
md
FastHTML Docs
explains/explaining_xt_components.html.md
# **FT** Components <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> **FT**, or ‘FastTags’, are the display components of FastHTML. In fact, the word “components” in the context of FastHTML is often synonymous with **FT**. For example, when we look at a FastHTML app, in particular the views, as well as v...
md
FastHTML Docs
explains/faq.html.md
# FAQ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ## Why does my editor say that I have errors in my FastHTML code? Many editors, including Visual Studio Code, use PyLance to provide error checking for Python. However, PyLance’s error checking is just a guess – it can’t actually know whether your co...
md
FastHTML Docs
explains/oauth.html.md
# OAuth <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> OAuth is an open standard for ‘access delegation’, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords. It is the mechanism that enables “Log...
md
FastHTML Docs
explains/routes.html.md
# Routes <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> Behaviour in FastHTML apps is defined by routes. The syntax is largely the same as the wonderful [FastAPI](https://fastapi.tiangolo.com/) (which is what you should be using instead of this if you’re creating a JSON service. FastHTML is mainly for m...
md
FastHTML Docs
ref/handlers.html.md
# Handling handlers <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ``` python from fasthtml.common import * from collections import namedtuple from typing import TypedDict from datetime import datetime import json,time ``` ``` python app = FastHTML() ``` The [`FastHTML`](https://AnswerDotAI.github.io/...
md
FastHTML Docs
ref/live_reload.html.md
# Live Reloading <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> When building your app it can be useful to view your changes in a web browser as you make them. FastHTML supports live reloading which means that it watches for any changes to your code and automatically refreshes the webpage in your browse...
md
FastHTML Docs
tutorials/by_example.html.md
# FastHTML By Example <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> This tutorial provides an alternate introduction to FastHTML by building out example applications. We also illustrate how to use FastHTML foundations to create custom web apps. Finally, this document serves as minimal context for a LLM...
md
FastHTML Docs
tutorials/e2e.html.md
# JS App Walkthrough <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ## Installation You’ll need the following software to complete the tutorial, read on for specific installation instructions: 1. Python 2. A Python package manager such as pip (which normally comes with Python) or uv 3. FastHTML...
md
FastHTML Docs
tutorials/tutorial_for_web_devs.html.md
# BYO Blog <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> <div> > **Caution** > > This document is a work in progress. </div> In this tutorial we’re going to write a blog by example. Blogs are a good way to learn a web framework as they start simple yet can get surprisingly sophistated. The [wikipedi...
md
HTMX Book Summary
https://gist.githubusercontent.com/jph00/4ad7d35ad79013aded41b5ba535a12a3/raw/f677ec873cedb23ccd81fd4f24ba3b903746e26a/hypermedia-applications.summ.md
# Hypermedia Systems: book summary This is a summary of "Hypermedia Systems" by Carson Gross, Adam Stepinski, Deniz Akşimşek. Summary created by Jeremy Howard with AI help. - [Website for the book](https://hypermedia.systems/) - The revolutionary ideas that empowered the Web - A simpler approach to building applicati...
md
FastHTML Source
fasthtml/authmw.py
import base64, binascii, re from fasthtml.core import * from fasthtml.starlette import * from typing import Mapping from hmac import compare_digest auth_hdrs = {'WWW-Authenticate': 'Basic realm="login"'} class BasicAuthMiddleware(MiddlewareBase): def __init__(self, app, cb, skip=None): self.app,self.cb,self.skip ...
py
FastHTML Source
fasthtml/basics.py
from .core import * from .components import * from .xtend import *
py
FastHTML Source
fasthtml/cli.py
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/09_cli.ipynb. # %% auto 0 __all__ = ['railway_link', 'railway_deploy'] # %% ../nbs/api/09_cli.ipynb from fastcore.utils import * from fastcore.script import call_parse, bool_arg from subprocess import check_output, run import json # %% ../nbs/api/09_cli.ipynb @...
py
FastHTML Source
fasthtml/common.py
import uvicorn from dataclasses import dataclass from .starlette import * from fastcore.utils import * from fastcore.xml import * from sqlite_minutils import Database from fastlite import * from .basics import * from .pico import * from .authmw import * from .live_reload import * from .toaster import * from .js import...
py
FastHTML Source
fasthtml/components.py
"""`ft_html` and `ft_hx` functions to add some conveniences to `ft`, along with a full set of basic HTML components, and functions to work with forms and `FT` conversion""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/01_components.ipynb. # %% auto 0 __all__ = ['named', 'html_attrs', 'hx_attrs', 'show', 'at...
py
FastHTML Source
fasthtml/core.py
"""The `FastHTML` subclass of `Starlette`, along with the `RouterX` and `RouteX` classes it automatically uses.""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/00_core.ipynb. # %% auto 0 __all__ = ['empty', 'htmx_hdrs', 'fh_cfg', 'htmx_resps', 'htmxsrc', 'htmxwssrc', 'fhjsscr', 'htmxctsrc', 'surrsrc', 'scop...
py
FastHTML Source
fasthtml/fastapp.py
"""The `fast_app` convenience wrapper""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/10_fastapp.ipynb. # %% ../nbs/api/10_fastapp.ipynb 3 from __future__ import annotations import inspect,uvicorn from fastcore.utils import * from fastlite import * from .basics import * from .pico import * from .starlette ...
py
FastHTML Source
fasthtml/ft.py
from fastcore.xml import * from .components import * from .xtend import *
py
FastHTML Source
fasthtml/js.py
"""Basic external Javascript lib wrappers""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/03_js.ipynb. # %% auto 0 __all__ = ['marked_imp', 'npmcdn', 'light_media', 'dark_media', 'MarkdownJS', 'KatexMarkdownJS', 'HighlightJS', 'SortableJS'] # %% ../nbs/api/03_js.ipynb import re from fastcore.utils import *...
py
FastHTML Source
fasthtml/live_reload.py
from starlette.routing import WebSocketRoute from fasthtml.basics import FastHTML, Script __all__ = ["FastHTMLWithLiveReload"] LIVE_RELOAD_SCRIPT = """ (function() {{ var socket = new WebSocket(`ws://${{window.location.host}}/live-reload`); var maxReloadAttempts = {reload_attempts}; var r...
py
FastHTML Source
fasthtml/oauth.py
"""Basic scaffolding for handling OAuth""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/08_oauth.ipynb. # %% auto 0 __all__ = ['GoogleAppClient', 'GitHubAppClient', 'HuggingFaceClient', 'DiscordAppClient', 'decode', 'OAuth'] # %% ../nbs/api/08_oauth.ipynb from .common import * from oauthlib.oauth2 import W...
py
FastHTML Source
fasthtml/pico.py
"""Basic components for generating Pico CSS tags""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/04_pico.ipynb. # %% auto 0 __all__ = ['picocss', 'picolink', 'picocondcss', 'picocondlink', 'set_pico_cls', 'Card', 'Group', 'Search', 'Grid', 'DialogX', 'Container', 'PicoBusy'] # %% ../nbs/api/04_p...
py
FastHTML Source
fasthtml/starlette.py
from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.middleware.sessions import SessionMiddleware from starlette.middleware.authentication import AuthenticationMiddleware from starlette.authentication import AuthCredentials, AuthenticationBackend, AuthenticationError, ...
py
FastHTML Source
fasthtml/svg.py
"""Simple SVG FT elements""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/05_svg.ipynb. # %% auto 0 __all__ = ['g', 'svg_inb', 'Svg', 'ft_svg', 'Rect', 'Circle', 'Ellipse', 'transformd', 'Line', 'Polyline', 'Polygon', 'Text', 'PathFT', 'Path', 'SvgOob', 'SvgInb', 'AltGlyph', 'AltGlyphDef', 'AltGl...
py
FastHTML Source
fasthtml/toaster.py
from fastcore.xml import FT from fasthtml.core import * from fasthtml.components import * from fasthtml.xtend import * tcid = 'fh-toast-container' sk = "toasts" toast_css = """ .fh-toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction...
py
FastHTML Source
fasthtml/xtend.py
"""Simple extensions to standard HTML components, such as adding sensible defaults""" # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/02_xtend.ipynb. # %% auto 0 __all__ = ['sid_scr', 'A', 'AX', 'Form', 'Hidden', 'CheckboxX', 'Script', 'Style', 'double_braces', 'undouble_braces', 'loose_format', 'Sc...
py
FastHTML Gallery
applications/applications/annotate_text/app.py
from fasthtml.common import * import json import httpx # Set up the app, including daisyui and tailwind for the chat component tlink = Script(src="https://cdn.tailwindcss.com?plugins=typography"), dlink = Link(rel="stylesheet", href="https://cdn.jsdelivr.net/npm/daisyui@4.11.1/dist/full.min.css") def Arrow(arrow, hx_...
py
FastHTML Gallery
applications/applications/cellular_automata/app.py
from fasthtml.common import * from starlette.responses import Response from uuid import uuid4 generator = {} bindict = { (1,1,1):0, (1,1,0):1, (1,0,1):2, (1,0,0):3, (0,1,1):4, (0,1,0):5, (0,0,1):6, (0,0,0):7} initial_row = [0]*50 + [1] + [0]*50 color_map = {0:"white", 1:"black"} #####...
py
FastHTML Gallery
applications/applications/tic_tac_toe/app.py
from fasthtml.common import * style = Style("""body{ min-height: 100vh; margin:0; background-color: #1A1A1E; display:grid; }""") # custom style to be applied globally. hdrs = (Script(src="https://cdn.tailwindcss.com") , Link(rel="stylesheet", href="/files/applications/applications/tic_tac_toe/...
py
FastHTML Gallery
applications/start_simple/csv_editor/app.py
from fasthtml.common import * from uuid import uuid4 db = database('sqlite.db') hdrs = (Style(''' button,input { margin: 0 1rem; } [role="group"] { border: 1px solid #ccc; } .edited { outline: 2px solid orange; } '''), ) app, rt = fast_app(hdrs=hdrs) navbar = Nav()(Div(cls="container")(Div(cls="grid")( H1("Fa...
py
FastHTML Gallery
applications/start_simple/sqlite_todo/app.py
from fasthtml.common import * from fastsql import * from sqlite_minutils.db import NotFoundError app,rt,todos,Todo = fast_app( 'data/todos.db', id=int, title=str, pk='id') def tid(id): return f'todo-{id}' @app.delete("/delete_todo",name='delete_todo') async def delete_todo(id:int): try: todos.delete(id...
py
FastHTML Gallery
examples/application_layout/bootstrap_collapsable_sidebar_1/app.py
from fasthtml.common import * from collections import namedtuple cdn = 'https://cdn.jsdelivr.net/npm/bootstrap' bootstrap_links = [ Link(href=cdn+"@5.3.3/dist/css/bootstrap.min.css", rel="stylesheet"), Script(src=cdn+"@5.3.3/dist/js/bootstrap.bundle.min.js"), Link(href=cdn+"-icons@1.11.3/font/bootstrap-ico...
py
FastHTML Gallery
examples/application_layout/two_column_grid/app.py
from fasthtml.common import * app, rt = fast_app() @app.get('/') def homepage(): return Titled('Try editing fields:', Grid( Form(post="submit", hx_target="#result", hx_trigger="input delay:200ms")( Select(Option("One"), Option("Two"), id="select"), Input(value='j', id="name", place...
py
FastHTML Gallery
examples/dynamic_user_interface/cascading_dropdowns/app.py
from fasthtml.common import * app, rt = fast_app() chapters = ['ch1', 'ch2', 'ch3'] lessons = { 'ch1': ['lesson1', 'lesson2', 'lesson3'], 'ch2': ['lesson4', 'lesson5', 'lesson6'], 'ch3': ['lesson7', 'lesson8', 'lesson9'] } def mk_opts(nm, cs): return ( Option(f'-- select {nm} --', disabled=''...
py
FastHTML Gallery
examples/dynamic_user_interface/click_to_edit/app.py
from fasthtml.common import * app, rt = fast_app() flds = dict(firstName='First Name', lastName='Last Name', email='Email') @dataclass class Contact: firstName:str; lastName:str; email:str; edit:bool=False def __ft__(self): def item(k, v): val = getattr(self,v) return Div(Label(...
py
FastHTML Gallery
examples/dynamic_user_interface/infinite_scroll/app.py
from fasthtml.common import * import uuid column_names = ('name', 'email', 'id') def generate_contact(id: int) -> Dict[str, str]: return {'name': 'Agent Smith', 'email': f'void{str(id)}@matrix.com', 'id': str(uuid.uuid4()) } def generate_table_row(row_num: int) -> Tr: cont...
py
FastHTML Gallery
examples/dynamic_user_interface/inline_validation/app.py
from fasthtml.common import * import re ################ ### FastHTML ### ################ app, rt = fast_app() @app.get('/') def homepage(): return Form(post='submit', hx_target='#submit-btn-container', hx_swap='outerHTML')( # Calls /email route to validate email Div(hx_target='...
py
FastHTML Gallery
examples/dynamic_user_interface/web_sockets/app.py
from fasthtml.common import * from collections import deque app = FastHTML(ws_hdr=True) # All messages here, but only most recent 15 are stored messages = deque(maxlen=15) users = {} # Takes all the messages and renders them box_style = "border: 1px solid #ccc; border-radius: 10px; padding: 10px; margin: 5px 0;" def...
py
FastHTML Gallery
examples/vizualizations/altair_charts/app.py
from fh_altair import altair2fasthml, altair_headers from fasthtml.common import * import numpy as np import pandas as pd import altair as alt app, rt = fast_app(hdrs=altair_headers) count = 0 plotdata = [] def generate_chart(): global plotdata if len(plotdata) > 250: plotdata = plotdata[-250:] ...
py
FastHTML Gallery
examples/vizualizations/bloch_sphere/app.py
import numpy as np from fasthtml.common import * import plotly.graph_objects as go from fh_plotly import plotly2fasthtml, plotly_headers ######################## ### FastHTML Section ### ######################## app, rt = fast_app(hdrs=plotly_headers) @app.get('/') def homepage(): desc = """ The Bloch Sphere...
py
FastHTML Gallery
examples/vizualizations/great_tables_tables/app.py
from functools import cache import polars as pl from great_tables import GT, html from great_tables.data import sza from fasthtml.common import * app, rt = fast_app() @cache def get_sza_pivot(): # Filter and pivot the data return (pl.from_pandas(sza) .filter((pl.col("latitude") == "20") & (pl.col(...
py
FastHTML Gallery
examples/vizualizations/matplotlib_charts/app.py
from fh_matplotlib import matplotlib2fasthtml from fasthtml.common import * import numpy as np import matplotlib.pylab as plt app, rt = fast_app() @matplotlib2fasthtml def generate_chart(num_points): plotdata = [np.random.exponential(1) for _ in range(num_points)] plt.plot(range(len(plotdata)), plotdata) @ap...
py
FastHTML Gallery
examples/vizualizations/plotly_charts/app.py
from fasthtml.common import * import pandas as pd import numpy as np import plotly.express as px from fh_plotly import plotly2fasthtml, plotly_headers app, rt = fast_app(hdrs=plotly_headers) y_data = [1, 2, 3, 2] x_data = [3, 1, 2, 4] def generate_line_chart(): df = pd.DataFrame({'y': y_data, 'x': x_data}) f...
py
FastHTML Gallery
examples/vizualizations/seaborn_svg/app.py
from fasthtml.common import * import numpy as np, seaborn as sns, matplotlib.pylab as plt app,rt = fast_app() data = np.random.rand(4,10) def fh_svg(func): "show svg in fasthtml decorator" def wrapper(*args, **kwargs): func(*args, **kwargs) # calls plotting function f = io.StringIO() # create a buffer...
py
FastHTML Gallery
examples/widgets/audio/app.py
import base64, requests from fasthtml.common import * app, rt = fast_app() @app.get('/') def homepage(): audio_path = "https://ucarecdn.com/abb35276-b3cb-4a5c-bba0-878f264e5976/AfricanFellaCumbiaDelishort.mp3" return Audio(src=f"data:audio/mp4;base64,{load_audio_base64(audio_path)}", controls=True) def load_...
py
FastHTML Gallery
examples/widgets/chat_bubble/app.py
from fasthtml.common import * app, rt = fast_app() @app.get('/') def homepage(): return Div(*[create_chat_message(**msg, msg_num=i) for i, msg in enumerate(example_messages)]) def create_chat_message(role, content, msg_num): if role == 'system': color = '#8B5CF6' elif role == 'user': color = "#F000B8" ...
py
FastHTML Gallery
examples/widgets/pdf/app.py
from fasthtml.common import * app, rt = fast_app() @rt('/') def homepage(): pdf_path = 'https://arxiv.org/pdf/1706.03762' return Embed(src=pdf_path, type='application/pdf', width='100%', height='1000px')
py
FastHTML Gallery
examples/widgets/progress_bar/app.py
from fasthtml.common import * import random app, rt = fast_app() def get_progress(percent_complete: int): # simulate progress check percent_complete += random.random()/3 return percent_complete @app.get('/') def homepage(): return Div(H3("Start the job to see progress!"),id='progress_bar'),Button("St...
py
FastHTML Gallery
examples/widgets/show_hide/app.py
from fasthtml.common import * app, rt = fast_app() content = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet volutpat tellus, in tincidunt magna. Vivamus congue posuere ligula a cursus. Sed efficitur tortor quis nisi mollis, eu aliquet nunc malesuada. Nulla semper lacus lacus, non sollicitudin...
py