Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,59 +10,59 @@ def display_html(html_code):
|
|
| 10 |
</div>
|
| 11 |
"""
|
| 12 |
|
| 13 |
-
# カスタムテーマ (
|
| 14 |
theme = gr.themes.Default(
|
| 15 |
-
primary_hue=gr.themes.colors.indigo,
|
| 16 |
secondary_hue=gr.themes.colors.blue,
|
| 17 |
neutral_hue=gr.themes.colors.gray,
|
| 18 |
-
font=[gr.themes.GoogleFont('Inter'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
| 19 |
).set(
|
| 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="
|
| 24 |
body_text_color_subdued="rgba(0, 0, 0, 0.6)",
|
| 25 |
|
| 26 |
# ブロック要素のスタイル
|
| 27 |
block_background_fill="white",
|
| 28 |
-
block_border_color="rgba(0, 0, 0, 0.1)",
|
| 29 |
block_border_width="1px",
|
| 30 |
-
block_border_radius="*radius_lg",
|
| 31 |
block_title_text_weight="600",
|
| 32 |
-
block_label_background_fill="rgba(0, 0, 0, 0.04)",
|
| 33 |
-
block_label_text_color="
|
| 34 |
-
block_label_text_size="
|
| 35 |
block_label_margin="0.5rem",
|
| 36 |
|
|
|
|
| 37 |
# ボタンのスタイル
|
| 38 |
-
button_primary_background_fill="
|
| 39 |
-
button_primary_background_fill_hover="
|
| 40 |
button_primary_text_color="white",
|
| 41 |
-
button_primary_border_radius="*radius_lg",
|
| 42 |
button_secondary_background_fill="white",
|
| 43 |
-
button_secondary_border_color="
|
| 44 |
-
button_secondary_text_color="
|
| 45 |
-
|
| 46 |
-
button_shadow="*shadow_drop_lg",
|
| 47 |
-
button_shadow_hover="*shadow_drop_lg"
|
| 48 |
|
| 49 |
# テキストボックス
|
| 50 |
input_background_fill="#f9fafb",
|
| 51 |
input_border_color="rgba(0, 0, 0, 0.2)",
|
| 52 |
input_border_width="1px",
|
| 53 |
-
input_text_size="
|
| 54 |
input_placeholder_color="rgba(0, 0, 0, 0.4)",
|
| 55 |
|
| 56 |
# その他
|
| 57 |
-
background_fill_secondary="white",
|
| 58 |
-
border_color_accent="
|
| 59 |
border_color_primary="rgba(0, 0, 0, 0.2)",
|
| 60 |
|
| 61 |
-
|
| 62 |
-
link_text_color = "
|
| 63 |
-
link_hover_color = "
|
| 64 |
-
link_visited_color = "
|
| 65 |
-
|
| 66 |
|
| 67 |
)
|
| 68 |
|
|
@@ -75,6 +75,10 @@ with gr.Blocks(theme=theme, title="HTML Viewer") as demo:
|
|
| 75 |
|
| 76 |
入力されたHTMLコードを、プレビュー表示します。
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
""")
|
| 79 |
with gr.Row():
|
| 80 |
with gr.Column(scale=1):
|
|
@@ -83,7 +87,7 @@ with gr.Blocks(theme=theme, title="HTML Viewer") as demo:
|
|
| 83 |
placeholder="ここにHTMLコードを貼り付けてください...",
|
| 84 |
lines=10
|
| 85 |
)
|
| 86 |
-
submit_button = gr.Button("表示", variant="primary")
|
| 87 |
with gr.Column(scale=3):
|
| 88 |
output_html = gr.HTML(label="プレビュー",)
|
| 89 |
|
|
|
|
| 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,
|
| 17 |
neutral_hue=gr.themes.colors.gray,
|
| 18 |
+
font=[gr.themes.GoogleFont('Inter'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
| 19 |
).set(
|
| 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", # text_md -> md
|
| 24 |
body_text_color_subdued="rgba(0, 0, 0, 0.6)",
|
| 25 |
|
| 26 |
# ブロック要素のスタイル
|
| 27 |
block_background_fill="white",
|
| 28 |
+
block_border_color="rgba(0, 0, 0, 0.1)",
|
| 29 |
block_border_width="1px",
|
| 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", # primary_500 -> primary
|
| 34 |
+
block_label_text_size="sm", # text_sm -> sm
|
| 35 |
block_label_margin="0.5rem",
|
| 36 |
|
| 37 |
+
|
| 38 |
# ボタンのスタイル
|
| 39 |
+
button_primary_background_fill="primary", # primary_500 -> primary
|
| 40 |
+
button_primary_background_fill_hover="dark", # primary_600 -> 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", # primary_500 -> primary
|
| 45 |
+
button_secondary_text_color="primary", # primary_500 -> primary
|
| 46 |
+
# 影
|
| 47 |
+
# button_shadow="*shadow_drop_lg", #Gradio5でエラーがでたらコメントアウト
|
| 48 |
+
# button_shadow_hover="*shadow_drop_lg",#Gradio5でエラーがでたらコメントアウト
|
| 49 |
|
| 50 |
# テキストボックス
|
| 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", # text_md -> md
|
| 55 |
input_placeholder_color="rgba(0, 0, 0, 0.4)",
|
| 56 |
|
| 57 |
# その他
|
| 58 |
+
background_fill_secondary="white",
|
| 59 |
+
border_color_accent="primary", # primary_500 -> 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 |
|
|
|
|
| 75 |
|
| 76 |
入力されたHTMLコードを、プレビュー表示します。
|
| 77 |
|
| 78 |
+
* 横スクロール禁止、縦スクロール許可
|
| 79 |
+
* レスポンシブデザイン (Gradio デフォルト)
|
| 80 |
+
* スマホでの表示は、PC版を縮小したようなイメージ
|
| 81 |
+
* インターコンチネンタル石垣島のクラブラウンジ風の、白く爽やかな外観(インディゴブルーでスタイリッシュに)
|
| 82 |
""")
|
| 83 |
with gr.Row():
|
| 84 |
with gr.Column(scale=1):
|
|
|
|
| 87 |
placeholder="ここにHTMLコードを貼り付けてください...",
|
| 88 |
lines=10
|
| 89 |
)
|
| 90 |
+
submit_button = gr.Button("表示", variant="primary")
|
| 91 |
with gr.Column(scale=3):
|
| 92 |
output_html = gr.HTML(label="プレビュー",)
|
| 93 |
|