File size: 662 Bytes
749d1d8 |
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 |
import gradio as gr
from rich.console import Console
from rich.syntax import Syntax
def log_file_to_html_string():
log_file = "mylog.log"
console = Console(record=True, width=150)
with open(log_file, "rt") as f:
syntax = Syntax(f.read(), "python", theme="monokai", word_wrap=True)
console.print(syntax)
html_content = console.export_html(inline_styles=True)
return html_content
with gr.Blocks() as demo:
name = gr.Markdown("# Reddit Scraper")
output = gr.HTML(log_file_to_html_string, every=1)
if __name__ == '__main__':
demo.launch(server_name="0.0.0.0", show_error=True, server_port=7860, enable_queue=True)
|