Spaces:
Sleeping
Sleeping
again, hopefuuly bg color change
Browse files
app.py
CHANGED
@@ -4,96 +4,8 @@ import openai
|
|
4 |
import os
|
5 |
|
6 |
# potential color customization
|
7 |
-
|
8 |
-
import gradio as gr
|
9 |
from transformers import pipeline
|
10 |
|
11 |
-
import gradio as gr
|
12 |
-
|
13 |
-
theme = gr.themes.Default(
|
14 |
-
primary_hue=gr.themes.Color(c100="#ffedd5", c200="#fed7aa", c300="#ffe09e", c400="#c2814c", c50="#fff8f0", c500="#f97316", c600="#ea580c", c700="#c2410c", c800="#9a3412", c900="#7c2d12", c950="#611f00"),
|
15 |
-
secondary_hue="red",
|
16 |
-
neutral_hue="slate",
|
17 |
-
font=[gr.themes.GoogleFont('jack armstrong'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
18 |
-
font_mono=[gr.themes.GoogleFont('xkcd'), 'ui-monospace', 'Consolas', 'monospace'],
|
19 |
-
).set(
|
20 |
-
body_text_color='*primary_950',
|
21 |
-
body_text_color_dark='*secondary_50',
|
22 |
-
body_text_size='*text_lg',
|
23 |
-
body_text_color_subdued='*primary_400',
|
24 |
-
body_text_weight='500',
|
25 |
-
background_fill_primary='*primary_300',
|
26 |
-
background_fill_primary_dark='*primary_800',
|
27 |
-
background_fill_secondary='*primary_50',
|
28 |
-
background_fill_secondary_dark='*primary_600',
|
29 |
-
border_color_accent='*secondary_950',
|
30 |
-
border_color_accent_dark='*body_text_color',
|
31 |
-
border_color_accent_subdued='*border_color_accent',
|
32 |
-
link_text_color='*secondary_800',
|
33 |
-
code_background_fill='*neutral_200',
|
34 |
-
code_background_fill_dark='*neutral_100',
|
35 |
-
block_shadow='none',
|
36 |
-
block_shadow_dark='none',
|
37 |
-
form_gap_width='0px',
|
38 |
-
checkbox_label_background_fill='*button_secondary_background_fill',
|
39 |
-
checkbox_label_background_fill_dark='*button_secondary_background_fill',
|
40 |
-
checkbox_label_background_fill_hover='*button_secondary_background_fill_hover',
|
41 |
-
checkbox_label_background_fill_hover_dark='*button_secondary_background_fill_hover',
|
42 |
-
checkbox_label_shadow='none',
|
43 |
-
error_background_fill_dark='*background_fill_primary',
|
44 |
-
input_background_fill='*neutral_100',
|
45 |
-
input_background_fill_dark='*neutral_700',
|
46 |
-
input_border_width='0px',
|
47 |
-
input_border_width_dark='0px',
|
48 |
-
input_shadow='none',
|
49 |
-
input_shadow_dark='none',
|
50 |
-
input_shadow_focus='*input_shadow',
|
51 |
-
input_shadow_focus_dark='*input_shadow',
|
52 |
-
stat_background_fill='*primary_300',
|
53 |
-
stat_background_fill_dark='*primary_500',
|
54 |
-
button_shadow='none',
|
55 |
-
button_shadow_active='none',
|
56 |
-
button_shadow_hover='none',
|
57 |
-
button_transition='background-color 0.2s ease',
|
58 |
-
button_primary_background_fill='*primary_200',
|
59 |
-
button_primary_background_fill_dark='*primary_700',
|
60 |
-
button_primary_background_fill_hover='*button_primary_background_fill',
|
61 |
-
button_primary_background_fill_hover_dark='*button_primary_background_fill',
|
62 |
-
button_primary_border_color_dark='*primary_600',
|
63 |
-
button_secondary_background_fill='*neutral_200',
|
64 |
-
button_secondary_background_fill_dark='*neutral_600',
|
65 |
-
button_secondary_background_fill_hover='*button_secondary_background_fill',
|
66 |
-
button_secondary_background_fill_hover_dark='*button_secondary_background_fill',
|
67 |
-
button_cancel_background_fill='*button_secondary_background_fill',
|
68 |
-
button_cancel_background_fill_dark='*button_secondary_background_fill',
|
69 |
-
button_cancel_background_fill_hover='*button_cancel_background_fill',
|
70 |
-
button_cancel_background_fill_hover_dark='*button_cancel_background_fill',
|
71 |
-
button_cancel_border_color='*button_secondary_border_color',
|
72 |
-
button_cancel_border_color_dark='*button_secondary_border_color',
|
73 |
-
button_cancel_text_color='*button_secondary_text_color',
|
74 |
-
button_cancel_text_color_dark='*button_secondary_text_color'
|
75 |
-
)
|
76 |
-
|
77 |
-
with gr.Blocks(theme=theme) as demo:
|
78 |
-
...
|
79 |
-
|
80 |
-
# Load the Hugging Face pipeline
|
81 |
-
# summarizer = pipeline("summarization")
|
82 |
-
|
83 |
-
# # Define the function to be used in the Gradio interface
|
84 |
-
# def summarize_text(text):
|
85 |
-
# summary = summarizer(text)[0]['summary_text']
|
86 |
-
# return summary
|
87 |
-
|
88 |
-
# Define custom CSS
|
89 |
-
# custom_css = ""
|
90 |
-
# body {
|
91 |
-
# background-color: #a9e3cb;
|
92 |
-
# }
|
93 |
-
# .gradio-title {
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
98 |
|
99 |
# Initialize paths and model identifiers for easy configuration and maintenance
|
@@ -210,24 +122,6 @@ topics = """
|
|
210 |
def display_image():
|
211 |
return "Globot_Logo3.jpg"
|
212 |
|
213 |
-
# with gr.Blocks(theme=theme) as demo:
|
214 |
-
# theme = gr.themes.Monochrome(
|
215 |
-
# primary_hue="amber",
|
216 |
-
# secondary_hue="rose",
|
217 |
-
# ).set(
|
218 |
-
# background_fill_primary='*primary_200',
|
219 |
-
# background_fill_primary_dark='*primary_200',
|
220 |
-
# background_fill_secondary='*secondary_300',
|
221 |
-
# background_fill_secondary_dark='*secondary_300',
|
222 |
-
# border_color_accent='*secondary_200',
|
223 |
-
# border_color_accent_dark='*secondary_600',
|
224 |
-
# border_color_accent_subdued='*secondary_200',
|
225 |
-
# border_color_primary='*secondary_300',
|
226 |
-
# block_border_color='*secondary_200',
|
227 |
-
# button_primary_background_fill='*secondary_300',
|
228 |
-
# button_primary_background_fill_dark='*secondary_300'
|
229 |
-
# )
|
230 |
-
|
231 |
# Setup the Gradio Blocks interface with custom layout components
|
232 |
with gr.Blocks(theme='gstaff/xkcd') as demo:
|
233 |
gr.Image(display_image(), width = 2000, height=600)
|
@@ -242,6 +136,72 @@ with gr.Blocks(theme='gstaff/xkcd') as demo:
|
|
242 |
submit_button = gr.Button("Submit")
|
243 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
|
|
|
|
|
|
246 |
# Launch the Gradio app to allow user interaction
|
247 |
demo.launch(share=True)
|
|
|
4 |
import os
|
5 |
|
6 |
# potential color customization
|
|
|
|
|
7 |
from transformers import pipeline
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
10 |
|
11 |
# Initialize paths and model identifiers for easy configuration and maintenance
|
|
|
122 |
def display_image():
|
123 |
return "Globot_Logo3.jpg"
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
# Setup the Gradio Blocks interface with custom layout components
|
126 |
with gr.Blocks(theme='gstaff/xkcd') as demo:
|
127 |
gr.Image(display_image(), width = 2000, height=600)
|
|
|
136 |
submit_button = gr.Button("Submit")
|
137 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
138 |
|
139 |
+
theme = gr.themes.Default(
|
140 |
+
primary_hue=gr.themes.Color(c100="#ffedd5", c200="#fed7aa", c300="#ffe09e", c400="#c2814c", c50="#fff8f0", c500="#f97316", c600="#ea580c", c700="#c2410c", c800="#9a3412", c900="#7c2d12", c950="#611f00"),
|
141 |
+
secondary_hue="red",
|
142 |
+
neutral_hue="slate",
|
143 |
+
font=[gr.themes.GoogleFont('jack armstrong'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
144 |
+
font_mono=[gr.themes.GoogleFont('xkcd'), 'ui-monospace', 'Consolas', 'monospace'],
|
145 |
+
).set(
|
146 |
+
body_text_color='*primary_950',
|
147 |
+
body_text_color_dark='*secondary_50',
|
148 |
+
body_text_size='*text_lg',
|
149 |
+
body_text_color_subdued='*primary_400',
|
150 |
+
body_text_weight='500',
|
151 |
+
background_fill_primary='*primary_300',
|
152 |
+
background_fill_primary_dark='*primary_800',
|
153 |
+
background_fill_secondary='*primary_50',
|
154 |
+
background_fill_secondary_dark='*primary_600',
|
155 |
+
border_color_accent='*secondary_950',
|
156 |
+
border_color_accent_dark='*body_text_color',
|
157 |
+
border_color_accent_subdued='*border_color_accent',
|
158 |
+
link_text_color='*secondary_800',
|
159 |
+
code_background_fill='*neutral_200',
|
160 |
+
code_background_fill_dark='*neutral_100',
|
161 |
+
block_shadow='none',
|
162 |
+
block_shadow_dark='none',
|
163 |
+
form_gap_width='0px',
|
164 |
+
checkbox_label_background_fill='*button_secondary_background_fill',
|
165 |
+
checkbox_label_background_fill_dark='*button_secondary_background_fill',
|
166 |
+
checkbox_label_background_fill_hover='*button_secondary_background_fill_hover',
|
167 |
+
checkbox_label_background_fill_hover_dark='*button_secondary_background_fill_hover',
|
168 |
+
checkbox_label_shadow='none',
|
169 |
+
error_background_fill_dark='*background_fill_primary',
|
170 |
+
input_background_fill='*neutral_100',
|
171 |
+
input_background_fill_dark='*neutral_700',
|
172 |
+
input_border_width='0px',
|
173 |
+
input_border_width_dark='0px',
|
174 |
+
input_shadow='none',
|
175 |
+
input_shadow_dark='none',
|
176 |
+
input_shadow_focus='*input_shadow',
|
177 |
+
input_shadow_focus_dark='*input_shadow',
|
178 |
+
stat_background_fill='*primary_300',
|
179 |
+
stat_background_fill_dark='*primary_500',
|
180 |
+
button_shadow='none',
|
181 |
+
button_shadow_active='none',
|
182 |
+
button_shadow_hover='none',
|
183 |
+
button_transition='background-color 0.2s ease',
|
184 |
+
button_primary_background_fill='*primary_200',
|
185 |
+
button_primary_background_fill_dark='*primary_700',
|
186 |
+
button_primary_background_fill_hover='*button_primary_background_fill',
|
187 |
+
button_primary_background_fill_hover_dark='*button_primary_background_fill',
|
188 |
+
button_primary_border_color_dark='*primary_600',
|
189 |
+
button_secondary_background_fill='*neutral_200',
|
190 |
+
button_secondary_background_fill_dark='*neutral_600',
|
191 |
+
button_secondary_background_fill_hover='*button_secondary_background_fill',
|
192 |
+
button_secondary_background_fill_hover_dark='*button_secondary_background_fill',
|
193 |
+
button_cancel_background_fill='*button_secondary_background_fill',
|
194 |
+
button_cancel_background_fill_dark='*button_secondary_background_fill',
|
195 |
+
button_cancel_background_fill_hover='*button_cancel_background_fill',
|
196 |
+
button_cancel_background_fill_hover_dark='*button_cancel_background_fill',
|
197 |
+
button_cancel_border_color='*button_secondary_border_color',
|
198 |
+
button_cancel_border_color_dark='*button_secondary_border_color',
|
199 |
+
button_cancel_text_color='*button_secondary_text_color',
|
200 |
+
button_cancel_text_color_dark='*button_secondary_text_color'
|
201 |
+
)
|
202 |
|
203 |
+
with gr.Blocks(theme=theme) as demo:
|
204 |
+
...
|
205 |
+
|
206 |
# Launch the Gradio app to allow user interaction
|
207 |
demo.launch(share=True)
|