Spaces:
Sleeping
Sleeping
crcdng
commited on
Commit
·
828a8ca
1
Parent(s):
51c74c6
custom font
Browse files- Cyberpunk.otf +0 -0
- Gradio_UI.py +33 -23
- styles.css +12 -0
Cyberpunk.otf
ADDED
|
Binary file (18.5 kB). View file
|
|
|
Gradio_UI.py
CHANGED
|
@@ -262,9 +262,19 @@ class GradioUI:
|
|
| 262 |
import gradio as gr
|
| 263 |
|
| 264 |
with gr.Blocks(fill_height=True, theme='crcdng/cyber') as demo:
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
label="Agent",
|
| 269 |
type="messages",
|
| 270 |
avatar_images=(
|
|
@@ -273,27 +283,27 @@ class GradioUI:
|
|
| 273 |
),
|
| 274 |
resizeable=True,
|
| 275 |
scale=0.05,
|
| 276 |
-
)
|
| 277 |
-
# If an upload folder is provided, enable the upload feature
|
| 278 |
-
if self.file_upload_folder is not None:
|
| 279 |
-
upload_file = gr.File(label="Upload a file")
|
| 280 |
-
upload_status = gr.Textbox(label="Upload Status", interactive=False, visible=False)
|
| 281 |
-
upload_file.change(
|
| 282 |
-
self.upload_file,
|
| 283 |
-
[upload_file, file_uploads_log],
|
| 284 |
-
[upload_status, file_uploads_log],
|
| 285 |
)
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
|
| 298 |
|
| 299 |
__all__ = ["stream_to_gradio", "GradioUI"]
|
|
|
|
| 262 |
import gradio as gr
|
| 263 |
|
| 264 |
with gr.Blocks(fill_height=True, theme='crcdng/cyber') as demo:
|
| 265 |
+
title=(
|
| 266 |
+
"""
|
| 267 |
+
<center>
|
| 268 |
+
<h1> Your Cyber Local Time Expert </h1>
|
| 269 |
+
</center>
|
| 270 |
+
"""
|
| 271 |
+
)
|
| 272 |
+
|
| 273 |
+
with gr.Row():
|
| 274 |
+
gr.HTML(title)
|
| 275 |
+
stored_messages = gr.State([])
|
| 276 |
+
file_uploads_log = gr.State([])
|
| 277 |
+
chatbot = gr.Chatbot(
|
| 278 |
label="Agent",
|
| 279 |
type="messages",
|
| 280 |
avatar_images=(
|
|
|
|
| 283 |
),
|
| 284 |
resizeable=True,
|
| 285 |
scale=0.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
)
|
| 287 |
+
# If an upload folder is provided, enable the upload feature
|
| 288 |
+
if self.file_upload_folder is not None:
|
| 289 |
+
upload_file = gr.File(label="Upload a file")
|
| 290 |
+
upload_status = gr.Textbox(label="Upload Status", interactive=False, visible=False)
|
| 291 |
+
upload_file.change(
|
| 292 |
+
self.upload_file,
|
| 293 |
+
[upload_file, file_uploads_log],
|
| 294 |
+
[upload_status, file_uploads_log],
|
| 295 |
+
)
|
| 296 |
+
text_input = gr.Textbox(lines=1, label="Chat Message")
|
| 297 |
+
text_input.submit(
|
| 298 |
+
self.log_user_message,
|
| 299 |
+
[text_input, file_uploads_log],
|
| 300 |
+
[stored_messages, text_input],
|
| 301 |
+
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
| 302 |
+
examples = gr.Examples(
|
| 303 |
+
examples=[["Tell me a joke based on the current local time"],["Given the current local time, what is a fun activity to do?"],["When asked for the current local time, add 6 hours to it. What is the current local time?"]],
|
| 304 |
+
inputs=[text_input],
|
| 305 |
+
)
|
| 306 |
+
demo.launch(debug=True, share=True, allowed_paths="Cyberpunk.otf", css="styles.css", **kwargs)
|
| 307 |
|
| 308 |
|
| 309 |
__all__ = ["stream_to_gradio", "GradioUI"]
|
styles.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@font-face {
|
| 2 |
+
font-family: "Cyberpunk";
|
| 3 |
+
src: url("/file=Cyberpunk.otf") format("otf");
|
| 4 |
+
font-weight: Regular;
|
| 5 |
+
font-style: normal;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
h1 {
|
| 9 |
+
font-family: "Cyberpunk";
|
| 10 |
+
font-size: 24px;
|
| 11 |
+
font-style: normal;
|
| 12 |
+
}
|