a-ragab-h-m's picture
Update app.py
9778b3f verified
raw
history blame
656 Bytes
import gradio as gr
import subprocess
logs = [] # ู„ุชุฎุฒูŠู† ุงู„ู„ูˆุฌุงุช
def run_training():
global logs
logs = []
process = subprocess.Popen(
["python", "run.py"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
bufsize=1
)
for line in process.stdout:
logs.append(line)
yield "\n".join(logs[:])
with gr.Blocks() as demo:
with gr.Row():
btn = gr.Button("๐Ÿš€ Start Training")
output = gr.Textbox(label="Logs", lines=25, interactive=False)
btn.click(fn=run_training, outputs=output)
demo.launch(server_name="0.0.0.0", server_port=7860)