Spaces:
Configuration error
Configuration error
File size: 865 Bytes
1fb2616 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
from gradio_log import Log
with open("/tmp/test.log", "wb") as f:
# write some random log to f, with colored and uncolored text
f.write(b"[INFO] Everything is fine.\n")
f.write(b"\x1b[34m[DEBUG] Debugging information.\x1b[0m\n")
f.write(b"\x1b[32m[SUCCESS] Task completed successfully.\x1b[0m\n")
f.write(b"\x1b[33m[WARNING] Something is not right.\x1b[0m\n")
f.write(b"\x1b[31m[ERROR] Unexpected error occured.\x1b[0m\n")
with gr.Blocks(theme=gr.themes.Soft()) as demo:
with gr.Row():
with gr.Column(scale=1):
Log("/tmp/test.log")
with gr.Column(scale=1):
Log(
"/tmp/test.log",
dark=True,
tail=4,
label="dark mode, read from last 4 lines of log",
)
if __name__ == "__main__":
demo.launch()
|