Spaces:
Paused
Paused
P01yH3dr0n
commited on
Commit
β’
31ebff9
1
Parent(s):
bc7cbda
Update app.py
Browse files
app.py
CHANGED
@@ -151,14 +151,26 @@ def util_ui():
|
|
151 |
items = gr.JSON(value=None, visible=False)
|
152 |
png2main = gr.Button('εζ°ειε°ζηεΎ')
|
153 |
return page, png2main, items, info, image
|
154 |
-
|
155 |
-
def
|
156 |
head = ''
|
157 |
with open('jsReloader.js', 'r', encoding='utf8') as j:
|
158 |
head += f'<script>{j.read()}</script>\n'
|
159 |
for f in sorted(os.listdir('./tagcomplete/javascript')):
|
160 |
head += f'<script type="text/javascript" src="file=tagcomplete/javascript/{f}"></script>\n'
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
with gr.Tabs():
|
163 |
with gr.TabItem("ζηεΎ", elem_id="client_ui_main"):
|
164 |
_, paras = main_ui()
|
|
|
151 |
items = gr.JSON(value=None, visible=False)
|
152 |
png2main = gr.Button('εζ°ειε°ζηεΎ')
|
153 |
return page, png2main, items, info, image
|
154 |
+
|
155 |
+
def load_javascript():
|
156 |
head = ''
|
157 |
with open('jsReloader.js', 'r', encoding='utf8') as j:
|
158 |
head += f'<script>{j.read()}</script>\n'
|
159 |
for f in sorted(os.listdir('./tagcomplete/javascript')):
|
160 |
head += f'<script type="text/javascript" src="file=tagcomplete/javascript/{f}"></script>\n'
|
161 |
+
|
162 |
+
share = gr.routes.templates.TemplateResponse
|
163 |
+
def template_response(*args, **kwargs):
|
164 |
+
res = share(*args, **kwargs)
|
165 |
+
res.body = res.body.replace(b'</body>', f'{head}</body>'.encode("utf8"))
|
166 |
+
res.init_headers()
|
167 |
+
return res
|
168 |
+
|
169 |
+
gr.routes.templates.TemplateResponse = template_response
|
170 |
+
|
171 |
+
def ui():
|
172 |
+
load_javascript()
|
173 |
+
with gr.Blocks(title="NAI Client", theme=gr.themes.Base()) as website:
|
174 |
with gr.Tabs():
|
175 |
with gr.TabItem("ζηεΎ", elem_id="client_ui_main"):
|
176 |
_, paras = main_ui()
|