Spaces:
Build error
Build error
Download main.py from pvanand/fastapi-dev-server: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/spaces/pvanand/fastapi-dev-server/resolve/db30326eefc720cb03c5f736d5afdbdf98ed81ec/main.py
- Command line
-
hf download hf://spaces/pvanand/fastapi-dev-server@db30326eefc720cb03c5f736d5afdbdf98ed81ec/main.py
-
curl -L -o main.py https://huggingface.co/spaces/pvanand/fastapi-dev-server/resolve/db30326eefc720cb03c5f736d5afdbdf98ed81ec/main.py
1.69 kB
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| import uvicorn | |
| app = FastAPI() | |
| async def root(): | |
| return """ | |
| <html> | |
| <head> | |
| <title>Welcome</title> | |
| </head> | |
| <body> | |
| <h1>Welcome to our website!</h1> | |
| <p>Please <a href="/login">login</a> or join our <a href="/waitlist">waitlist</a>.</p> | |
| </body> | |
| </html> | |
| """ | |
| async def login(): | |
| return """ | |
| <html> | |
| <head> | |
| <title>Login</title> | |
| </head> | |
| <body> | |
| <h1>Login</h1> | |
| <form action="/login" method="post"> | |
| <label for="username">Username:</label> | |
| <input type="text" id="username" name="username"><br><br> | |
| <label for="password">Password:</label> | |
| <input type="password" id="password" name="password"><br><br> | |
| <input type="submit" value="Submit"> | |
| </form> | |
| </body> | |
| </html> | |
| """ | |
| async def waitlist(): | |
| return """ | |
| <html> | |
| <head> | |
| <title>Join Waitlist</title> | |
| </head> | |
| <body> | |
| <h1>Join Our Waitlist</h1> | |
| <form action="/waitlist" method="post"> | |
| <label for="email">Email:</label> | |
| <input type="email" id="email" name="email"><br><br> | |
| <input type="submit" value="Join Waitlist"> | |
| </form> | |
| </body> | |
| </html> | |
| """ | |
| if __name__ == "__main__": | |
| uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True, debug=True) |