watagassy commited on
Commit
4b2b8c3
·
verified ·
1 Parent(s): c79b68a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -1
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import os
2
 
3
  import gradio as gr
 
 
4
  from transformers.utils import logging
5
 
6
  from langchain_ollama import OllamaEmbeddings
@@ -53,6 +55,46 @@ def hybrid_search(input_text, top_k):
53
  return "\n\n************************************************************\n\n".join(all_answers)
54
 
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  CSS ="""
57
  .contain { display: flex; flex-direction: column; }
58
  .gradio-container { height: 100vh !important; }
@@ -64,7 +106,7 @@ CSS ="""
64
  #question-box { font-size:18px !important; font-weight:500 !important; }
65
  """
66
  #with gr.Blocks() as demo:
67
- with gr.Blocks(theme=gr.themes.Monochrome(radius_size=gr.themes.sizes.radius_sm)) as demo:
68
  with gr.Row():
69
  with gr.Column():
70
  gr.Markdown(f"""
 
1
  import os
2
 
3
  import gradio as gr
4
+ from gradio.themes.base import Base
5
+ from gradio.themes.utils import colors, fonts, sizes
6
  from transformers.utils import logging
7
 
8
  from langchain_ollama import OllamaEmbeddings
 
55
  return "\n\n************************************************************\n\n".join(all_answers)
56
 
57
 
58
+ # カスタムテーマの作成
59
+ class CustomTheme(Base):
60
+ def __init__(
61
+ self,
62
+ *,
63
+ primary_hue: colors.Color | str = colors.blue,
64
+ secondary_hue: colors.Color | str = colors.gray,
65
+ neutral_hue: colors.Color | str = colors.gray,
66
+ spacing_size: sizes.Size | str = sizes.spacing_md,
67
+ radius_size: sizes.Size | str = sizes.radius_md,
68
+ text_size: sizes.Size | str = sizes.text_lg, # フォントサイズを大きく設定
69
+ font: fonts.Font
70
+ | str
71
+ | list[fonts.Font | str] = (
72
+ fonts.GoogleFont("IBM Plex Sans"),
73
+ "Arial",
74
+ "sans-serif",
75
+ ),
76
+ font_mono: fonts.Font
77
+ | str
78
+ | list[fonts.Font | str] = (
79
+ fonts.GoogleFont("IBM Plex Mono"),
80
+ "Courier",
81
+ "monospace",
82
+ ),
83
+ ):
84
+ super().__init__(
85
+ primary_hue=primary_hue,
86
+ secondary_hue=secondary_hue,
87
+ neutral_hue=neutral_hue,
88
+ spacing_size=spacing_size,
89
+ radius_size=radius_size,
90
+ text_size=text_size,
91
+ font=font,
92
+ font_mono=font_mono,
93
+ )
94
+
95
+ # カスタムテーマの適用
96
+ theme = CustomTheme()
97
+
98
  CSS ="""
99
  .contain { display: flex; flex-direction: column; }
100
  .gradio-container { height: 100vh !important; }
 
106
  #question-box { font-size:18px !important; font-weight:500 !important; }
107
  """
108
  #with gr.Blocks() as demo:
109
+ with gr.Blocks(theme=theme) as demo:
110
  with gr.Row():
111
  with gr.Column():
112
  gr.Markdown(f"""