Spaces:
Runtime error
Runtime error
"""This files enables serving Panel apps on Hugging Face Spaces""" | |
import solara | |
def Page(): | |
clicks, set_clicks = solara.use_state(0) | |
return solara.VBox( | |
[ | |
solara.Button("Click me", on_click=lambda: set_clicks(clicks + 1)), | |
solara.Text(f"Clicks: {clicks}"), | |
] | |
) | |
def run(*,port=8877, host=None): | |
import os | |
if host is None: | |
host = os.environ.get("HOST") | |
if host is None: | |
host = os.getenv("GRADIO_SERVER_NAME") | |
if host is None: | |
host = "localhost" | |
os.environ["SOLARA_APP"] = "__main__" | |
import uvicorn | |
# force change | |
from solara.server.starlette import app as asgi_app | |
config = uvicorn.Config( | |
app=asgi_app, | |
host=host, | |
port=port, | |
) | |
server = uvicorn.Server(config=config) | |
server.run() | |
print("just run2!") | |
run(port=7860) |