mohamedrady's picture
Update app.py
0fa896d verified
raw
history blame
672 Bytes
import gradio as gr
import subprocess
def run_scripts():
outputs = []
scripts = ["firstkha.py", "alf.py"]
for script in scripts:
try:
result = subprocess.run(["python", script], check=True, text=True, capture_output=True)
outputs.append(f"Output of {script}:\n{result.stdout}")
except subprocess.CalledProcessError as e:
outputs.append(f"Error running {script}:\n{e.stderr}")
return "\n\n".join(outputs)
iface = gr.Interface(
fn=run_scripts,
inputs=[],
outputs="text",
live=True,
description="Run the scripts firstkha.py and alf.py"
)
if __name__ == "__main__":
iface.launch()