sirochild commited on
Commit
c3aef17
·
verified ·
1 Parent(s): e99eb43

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +10 -9
  2. style.css +27 -3
app.py CHANGED
@@ -333,21 +333,21 @@ def respond(message, chat_history, affection, history, scene_params):
333
  with open("style.css", "r") as f:
334
  custom_css = f.read()
335
 
336
- # Gradio 5.x用のテーマ設定
337
  custom_theme = gr.themes.Soft(
338
  primary_hue="rose",
339
  secondary_hue="pink",
340
  )
341
 
342
- # Gradio 5.xでのテーマカスタマイズ
343
  try:
344
- # 透明度を持つ背景色を設定
345
- custom_theme = custom_theme.set(
346
- body_background_fill="rgba(255, 255, 255, 0.2)",
347
- block_background_fill="rgba(255, 255, 255, 0.1)",
348
- block_label_background_fill="rgba(255, 255, 255, 0.2)",
349
- input_background_fill="rgba(255, 255, 255, 0.6)",
350
- chatbot_code_background_fill="rgba(0, 0, 0, 0.1)",
351
  )
352
  except Exception as e:
353
  print(f"テーマカスタマイズエラー: {e}")
@@ -379,6 +379,7 @@ with gr.Blocks(css=custom_css, theme=custom_theme) as demo:
379
  elem_id="chat_area",
380
  show_label=False,
381
  height=400,
 
382
  avatar_images=[
383
  "https://cdn.pixabay.com/photo/2016/04/01/10/04/amusing-1299756_1280.png",
384
  "https://cdn.pixabay.com/photo/2016/03/31/21/40/bot-1296595_1280.png"
 
333
  with open("style.css", "r") as f:
334
  custom_css = f.read()
335
 
336
+ # Gradio 5.x用のシンプルなテーマ設定
337
  custom_theme = gr.themes.Soft(
338
  primary_hue="rose",
339
  secondary_hue="pink",
340
  )
341
 
342
+ # Gradio 5.xでのテーマカスタマイズ(最小限の設定のみ)
343
  try:
344
+ # 透明度を持つ背景色を設定(Gradio 5.0で確実に動作するプロパティのみ)
345
+ custom_theme = gr.themes.Soft(
346
+ primary_hue="rose",
347
+ secondary_hue="pink",
348
+ neutral_hue="slate",
349
+ spacing_size="sm",
350
+ radius_size="lg",
351
  )
352
  except Exception as e:
353
  print(f"テーマカスタマイズエラー: {e}")
 
379
  elem_id="chat_area",
380
  show_label=False,
381
  height=400,
382
+ type="messages", # 警告を解消するために追加
383
  avatar_images=[
384
  "https://cdn.pixabay.com/photo/2016/04/01/10/04/amusing-1299756_1280.png",
385
  "https://cdn.pixabay.com/photo/2016/03/31/21/40/bot-1296595_1280.png"
style.css CHANGED
@@ -7,10 +7,21 @@ body {
7
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
8
  }
9
 
10
- /* メインコンテナ */
11
  .gradio-container {
12
  max-width: 1200px !important;
13
  margin: 0 auto !important;
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
  /* ========================
@@ -25,6 +36,7 @@ body {
25
  height: 100% !important;
26
  z-index: -100 !important; /* UIの後ろに配置 */
27
  pointer-events: none !important;
 
28
  }
29
 
30
  /* 背景画像 */
@@ -36,8 +48,20 @@ body {
36
  height: 100% !important;
37
  background-size: cover !important;
38
  background-position: center !important;
39
- opacity: 0.15 !important; /* 薄く表示 */
40
- filter: blur(1px) !important; /* 少しぼかす */
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
 
43
  /* ========================
 
7
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
8
  }
9
 
10
+ /* Gradio 5.0のコンテナスタイル */
11
  .gradio-container {
12
  max-width: 1200px !important;
13
  margin: 0 auto !important;
14
+ position: relative !important;
15
+ z-index: 1 !important;
16
+ }
17
+
18
+ /* Gradio 5.0のブロックスタイル */
19
+ .gradio-container > div > div {
20
+ background-color: rgba(255, 255, 255, 0.85) !important;
21
+ border-radius: 12px !important;
22
+ margin-bottom: 16px !important;
23
+ padding: 16px !important;
24
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
25
  }
26
 
27
  /* ========================
 
36
  height: 100% !important;
37
  z-index: -100 !important; /* UIの後ろに配置 */
38
  pointer-events: none !important;
39
+ overflow: hidden !important;
40
  }
41
 
42
  /* 背景画像 */
 
48
  height: 100% !important;
49
  background-size: cover !important;
50
  background-position: center !important;
51
+ opacity: 0.2 !important; /* 薄く表示 */
52
+ filter: blur(2px) !important; /* 少しぼかす */
53
+ }
54
+
55
+ /* 背景画像の上に半透明のオーバーレイを追加 */
56
+ .background-container::after {
57
+ content: "" !important;
58
+ position: absolute !important;
59
+ top: 0 !important;
60
+ left: 0 !important;
61
+ width: 100% !important;
62
+ height: 100% !important;
63
+ background: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5)) !important;
64
+ z-index: -99 !important;
65
  }
66
 
67
  /* ========================