Spaces:
Sleeping
Sleeping
Commit
·
8a02447
1
Parent(s):
df7913a
min
Browse files
app.py
CHANGED
|
@@ -1,26 +1,8 @@
|
|
| 1 |
from fasthtml.common import *
|
| 2 |
|
| 3 |
-
|
| 4 |
-
hdrs = (HighlightJS(langs=['python', 'javascript', 'html', 'css']),)
|
| 5 |
-
|
| 6 |
-
app, rt = fast_app(hdrs=hdrs)
|
| 7 |
-
|
| 8 |
-
code_example = """
|
| 9 |
-
import datetime
|
| 10 |
-
import time
|
| 11 |
-
|
| 12 |
-
for i in range(10):
|
| 13 |
-
print(f"{datetime.datetime.now()}")
|
| 14 |
-
time.sleep(1)
|
| 15 |
-
"""
|
| 16 |
|
| 17 |
@rt('/')
|
| 18 |
-
def get(
|
| 19 |
-
return Titled("Markdown rendering example",
|
| 20 |
-
Div(
|
| 21 |
-
# The code example needs to be surrounded by
|
| 22 |
-
# Pre & Code elements
|
| 23 |
-
Pre(Code(code_example))
|
| 24 |
-
))
|
| 25 |
|
| 26 |
-
serve(
|
|
|
|
| 1 |
from fasthtml.common import *
|
| 2 |
|
| 3 |
+
app,rt = fast_app()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
@rt('/')
|
| 6 |
+
def get(): return Div(P('Hello World!'), hx_get="/change")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
serve(port=7860)
|