Migrate to Gradio 6 API: theme/css/head to launch(), remove Chatbot type param
Browse files
app.py
CHANGED
|
@@ -829,15 +829,6 @@ CUSTOM_HEAD = """\
|
|
| 829 |
# ---------------------------------------------------------------------------
|
| 830 |
with gr.Blocks(
|
| 831 |
title="Case Lantern 🏮",
|
| 832 |
-
theme=gr.themes.Base(
|
| 833 |
-
primary_hue="rose",
|
| 834 |
-
secondary_hue="teal",
|
| 835 |
-
neutral_hue="slate",
|
| 836 |
-
radius_size="lg",
|
| 837 |
-
font=[gr.themes.GoogleFont("Inter"), "Noto Sans SC", "system-ui", "sans-serif"],
|
| 838 |
-
),
|
| 839 |
-
css=CUSTOM_CSS,
|
| 840 |
-
head=CUSTOM_HEAD,
|
| 841 |
) as demo:
|
| 842 |
game_state = gr.State(GameState())
|
| 843 |
|
|
@@ -858,10 +849,8 @@ with gr.Blocks(
|
|
| 858 |
with gr.Column(scale=3):
|
| 859 |
chatbot = gr.Chatbot(
|
| 860 |
label="案件记录",
|
| 861 |
-
type="messages",
|
| 862 |
height=560,
|
| 863 |
show_copy_button=True,
|
| 864 |
-
avatar_images=(None, None),
|
| 865 |
elem_id="case-chat",
|
| 866 |
)
|
| 867 |
|
|
@@ -942,6 +931,15 @@ if __name__ == "__main__":
|
|
| 942 |
launch_kwargs = {
|
| 943 |
"show_api": False,
|
| 944 |
"share": os.getenv("GRADIO_SHARE", "false").lower() in {"1", "true", "yes", "on"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 945 |
}
|
| 946 |
if os.getenv("GRADIO_SERVER_NAME"):
|
| 947 |
launch_kwargs["server_name"] = os.getenv("GRADIO_SERVER_NAME")
|
|
|
|
| 829 |
# ---------------------------------------------------------------------------
|
| 830 |
with gr.Blocks(
|
| 831 |
title="Case Lantern 🏮",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 832 |
) as demo:
|
| 833 |
game_state = gr.State(GameState())
|
| 834 |
|
|
|
|
| 849 |
with gr.Column(scale=3):
|
| 850 |
chatbot = gr.Chatbot(
|
| 851 |
label="案件记录",
|
|
|
|
| 852 |
height=560,
|
| 853 |
show_copy_button=True,
|
|
|
|
| 854 |
elem_id="case-chat",
|
| 855 |
)
|
| 856 |
|
|
|
|
| 931 |
launch_kwargs = {
|
| 932 |
"show_api": False,
|
| 933 |
"share": os.getenv("GRADIO_SHARE", "false").lower() in {"1", "true", "yes", "on"},
|
| 934 |
+
"theme": gr.themes.Base(
|
| 935 |
+
primary_hue="rose",
|
| 936 |
+
secondary_hue="teal",
|
| 937 |
+
neutral_hue="slate",
|
| 938 |
+
radius_size="lg",
|
| 939 |
+
font=[gr.themes.GoogleFont("Inter"), "Noto Sans SC", "system-ui", "sans-serif"],
|
| 940 |
+
),
|
| 941 |
+
"css": CUSTOM_CSS,
|
| 942 |
+
"head": CUSTOM_HEAD,
|
| 943 |
}
|
| 944 |
if os.getenv("GRADIO_SERVER_NAME"):
|
| 945 |
launch_kwargs["server_name"] = os.getenv("GRADIO_SERVER_NAME")
|