File size: 804 Bytes
f47057d
 
 
 
ab7bca8
 
f47057d
ab7bca8
f47057d
 
ab7bca8
 
f47057d
ab7bca8
 
f47057d
ab7bca8
 
f47057d
ab7bca8
f47057d
ab7bca8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import subprocess
import os

def run_training_and_return_zip():
    # Run training and capture logs
    result = subprocess.run(["python", "train.py"], capture_output=True, text=True)

    zip_path = "/home/user/app/model.zip"
    if os.path.exists(zip_path):
        logs = result.stdout + "\n" + result.stderr + "\n✅ Training complete. Download your model below."
        return logs, zip_path
    else:
        logs = result.stdout + "\n" + result.stderr + "\n❌ model.zip not found. Check logs for issues."
        return logs, None

gr.Interface(
    fn=run_training_and_return_zip,
    inputs=[],
    outputs=["text", "file"],
    title="LLaMA LoRA Fine-Tuning",
    description="Click the button to fine-tune. After training, download the zipped model directly."
).launch()