File size: 1,051 Bytes
6350667
 
57ac9fb
 
 
 
6350667
 
 
 
 
 
 
57ac9fb
 
6350667
57ac9fb
6350667
 
 
57ac9fb
 
 
 
 
b19cc5f
 
 
 
 
 
57ac9fb
b19cc5f
 
57ac9fb
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from __future__ import annotations

import os

import gradio as gr

import health
from layout import CELL_CSS, wrap_cell


def render_health_panel() -> str:
    return wrap_cell(health.render_health_notice())


def create_app() -> gr.Blocks:
    """Create the Gradio application with a minimal notebook-like health cell."""
    with gr.Blocks(title="Aileen3 Demo") as demo:
        gr.HTML(f"<style>{CELL_CSS}</style>")
        health_panel = gr.HTML(value=wrap_cell(health.render_placeholder_notice()))
        demo.load(fn=render_health_panel, outputs=health_panel, queue=False)
    return demo


def main() -> None:
    app = create_app()
    server_name = os.environ.get("GRADIO_SERVER_NAME") or os.environ.get("HOST") or "0.0.0.0"
    port_value = os.environ.get("GRADIO_SERVER_PORT") or os.environ.get("PORT") or "7860"
    try:
        server_port = int(port_value)
    except ValueError:
        server_port = 7860
    app.launch(
        server_name=server_name,
        server_port=server_port,
    )


if __name__ == "__main__":
    main()