Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ def display_html(html_code):
|
|
| 10 |
</div>
|
| 11 |
"""
|
| 12 |
|
| 13 |
-
# カスタムテーマ (Gradio 5.x
|
| 14 |
theme = gr.themes.Default(
|
| 15 |
primary_hue=gr.themes.colors.indigo,
|
| 16 |
secondary_hue=gr.themes.colors.blue,
|
|
@@ -20,7 +20,7 @@ theme = gr.themes.Default(
|
|
| 20 |
# 全体的なスタイルの微調整
|
| 21 |
body_background_fill="linear-gradient(to bottom right, #f5f5f5, #e0e7ff)",
|
| 22 |
body_text_color="rgba(0, 0, 0, 0.8)",
|
| 23 |
-
body_text_size="md",
|
| 24 |
body_text_color_subdued="rgba(0, 0, 0, 0.6)",
|
| 25 |
|
| 26 |
# ブロック要素のスタイル
|
|
@@ -30,19 +30,19 @@ theme = gr.themes.Default(
|
|
| 30 |
# block_border_radius="*radius_lg", # Gradio 5 でエラーが出る場合はコメントアウト
|
| 31 |
block_title_text_weight="600",
|
| 32 |
block_label_background_fill="rgba(0, 0, 0, 0.04)",
|
| 33 |
-
block_label_text_color="primary",
|
| 34 |
-
block_label_text_size="sm",
|
| 35 |
block_label_margin="0.5rem",
|
| 36 |
|
| 37 |
|
| 38 |
# ボタンのスタイル
|
| 39 |
-
button_primary_background_fill="primary",
|
| 40 |
-
button_primary_background_fill_hover="dark",
|
| 41 |
button_primary_text_color="white",
|
| 42 |
# button_primary_border_radius="*radius_lg", # Gradio 5 でエラーが出る場合はコメントアウト
|
| 43 |
button_secondary_background_fill="white",
|
| 44 |
-
button_secondary_border_color="primary",
|
| 45 |
-
button_secondary_text_color="primary",
|
| 46 |
# 影
|
| 47 |
# button_shadow="*shadow_drop_lg", #Gradio5でエラーがでたらコメントアウト
|
| 48 |
# button_shadow_hover="*shadow_drop_lg",#Gradio5でエラーがでたらコメントアウト
|
|
@@ -51,24 +51,35 @@ theme = gr.themes.Default(
|
|
| 51 |
input_background_fill="#f9fafb",
|
| 52 |
input_border_color="rgba(0, 0, 0, 0.2)",
|
| 53 |
input_border_width="1px",
|
| 54 |
-
input_text_size="md",
|
| 55 |
input_placeholder_color="rgba(0, 0, 0, 0.4)",
|
| 56 |
|
| 57 |
# その他
|
| 58 |
background_fill_secondary="white",
|
| 59 |
-
border_color_accent="primary",
|
| 60 |
border_color_primary="rgba(0, 0, 0, 0.2)",
|
| 61 |
|
| 62 |
-
|
| 63 |
-
link_text_color = "secondary", # secondary_500 -> secondary
|
| 64 |
-
link_hover_color = "dark", # secondary_600 -> dark
|
| 65 |
-
link_visited_color = "darker", # secondary_700 -> darker
|
| 66 |
-
|
| 67 |
)
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
-
with gr.Blocks(theme=theme, title="HTML Viewer") as demo:
|
| 72 |
gr.Markdown(
|
| 73 |
"""
|
| 74 |
# HTML Viewer
|
|
|
|
| 10 |
</div>
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
# カスタムテーマ (Gradio 5.x 系対応, link関連を削除)
|
| 14 |
theme = gr.themes.Default(
|
| 15 |
primary_hue=gr.themes.colors.indigo,
|
| 16 |
secondary_hue=gr.themes.colors.blue,
|
|
|
|
| 20 |
# 全体的なスタイルの微調整
|
| 21 |
body_background_fill="linear-gradient(to bottom right, #f5f5f5, #e0e7ff)",
|
| 22 |
body_text_color="rgba(0, 0, 0, 0.8)",
|
| 23 |
+
body_text_size="md",
|
| 24 |
body_text_color_subdued="rgba(0, 0, 0, 0.6)",
|
| 25 |
|
| 26 |
# ブロック要素のスタイル
|
|
|
|
| 30 |
# block_border_radius="*radius_lg", # Gradio 5 でエラーが出る場合はコメントアウト
|
| 31 |
block_title_text_weight="600",
|
| 32 |
block_label_background_fill="rgba(0, 0, 0, 0.04)",
|
| 33 |
+
block_label_text_color="primary",
|
| 34 |
+
block_label_text_size="sm",
|
| 35 |
block_label_margin="0.5rem",
|
| 36 |
|
| 37 |
|
| 38 |
# ボタンのスタイル
|
| 39 |
+
button_primary_background_fill="primary",
|
| 40 |
+
button_primary_background_fill_hover="dark",
|
| 41 |
button_primary_text_color="white",
|
| 42 |
# button_primary_border_radius="*radius_lg", # Gradio 5 でエラーが出る場合はコメントアウト
|
| 43 |
button_secondary_background_fill="white",
|
| 44 |
+
button_secondary_border_color="primary",
|
| 45 |
+
button_secondary_text_color="primary",
|
| 46 |
# 影
|
| 47 |
# button_shadow="*shadow_drop_lg", #Gradio5でエラーがでたらコメントアウト
|
| 48 |
# button_shadow_hover="*shadow_drop_lg",#Gradio5でエラーがでたらコメントアウト
|
|
|
|
| 51 |
input_background_fill="#f9fafb",
|
| 52 |
input_border_color="rgba(0, 0, 0, 0.2)",
|
| 53 |
input_border_width="1px",
|
| 54 |
+
input_text_size="md",
|
| 55 |
input_placeholder_color="rgba(0, 0, 0, 0.4)",
|
| 56 |
|
| 57 |
# その他
|
| 58 |
background_fill_secondary="white",
|
| 59 |
+
border_color_accent="primary",
|
| 60 |
border_color_primary="rgba(0, 0, 0, 0.2)",
|
| 61 |
|
| 62 |
+
# link_* 関連の設定は削除。CSSで対応
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
)
|
| 64 |
|
| 65 |
+
# カスタム CSS (リンクのスタイル)
|
| 66 |
+
css = """
|
| 67 |
+
a {
|
| 68 |
+
color: var(--link-text-color);
|
| 69 |
+
text-decoration: underline; /* または none など */
|
| 70 |
+
}
|
| 71 |
+
a:hover {
|
| 72 |
+
color: var(--link-hover-color);
|
| 73 |
+
}
|
| 74 |
+
a:visited {
|
| 75 |
+
color: var(--link-visited-color);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/* 必要に応じて、さらに詳細なスタイルをCSSで追加 */
|
| 79 |
+
"""
|
| 80 |
|
| 81 |
|
| 82 |
+
with gr.Blocks(theme=theme, title="HTML Viewer", css=css) as demo: # css引数を追加
|
| 83 |
gr.Markdown(
|
| 84 |
"""
|
| 85 |
# HTML Viewer
|