Spaces:
Running
Running
Fix Gradio Space app for HF runtime
Browse files
app.py
CHANGED
|
@@ -1,7 +1,4 @@
|
|
| 1 |
-
"""Hugging Face Space — documentation landing page for LoboForge-LensTrainer.
|
| 2 |
-
|
| 3 |
-
Training runs on your GPU (local or RunPod), not inside this Space.
|
| 4 |
-
"""
|
| 5 |
|
| 6 |
from __future__ import annotations
|
| 7 |
|
|
@@ -11,8 +8,7 @@ GITHUB = "https://github.com/LoboForge/LoboForge-LensTrainer"
|
|
| 11 |
LENS_BASE = "https://huggingface.co/microsoft/Lens-Base"
|
| 12 |
LORA_EXAMPLE = "https://huggingface.co/LoboForge/lens-lora-sebastian-jessica-v2"
|
| 13 |
|
| 14 |
-
ABOUT = f"""
|
| 15 |
-
# LoboForge LensTrainer
|
| 16 |
|
| 17 |
Config-driven **LoRA trainer** for [Microsoft Lens-Base]({LENS_BASE}).
|
| 18 |
|
|
@@ -24,11 +20,10 @@ Config-driven **LoRA trainer** for [Microsoft Lens-Base]({LENS_BASE}).
|
|
| 24 |
|
| 25 |
**Source code & install:** [{GITHUB}]({GITHUB})
|
| 26 |
|
| 27 |
-
This Space is a **documentation hub**. Clone the repo and run training on your
|
| 28 |
"""
|
| 29 |
|
| 30 |
-
QUICKSTART = f"""
|
| 31 |
-
## Install (local)
|
| 32 |
|
| 33 |
```bash
|
| 34 |
git clone {GITHUB}.git
|
|
@@ -37,7 +32,7 @@ python -m venv .venv && source .venv/bin/activate
|
|
| 37 |
pip install -r requirements.txt
|
| 38 |
bash scripts/install_microsoft_lens.sh
|
| 39 |
export PYTHONPATH="$(pwd)/vendor/Lens:$PYTHONPATH"
|
| 40 |
-
huggingface-cli login
|
| 41 |
```
|
| 42 |
|
| 43 |
## Train
|
|
@@ -58,38 +53,21 @@ python train.py configs/train_lora_lens_base_24gb.yaml \\
|
|
| 58 |
--output-dir ./output/my-lora \\
|
| 59 |
--resume latest
|
| 60 |
```
|
| 61 |
-
|
| 62 |
-
Full docs: [README on GitHub]({GITHUB}#readme)
|
| 63 |
-
"""
|
| 64 |
-
|
| 65 |
-
LORAS = f"""
|
| 66 |
-
## Published example LoRAs
|
| 67 |
-
|
| 68 |
-
| LoRA | Hub |
|
| 69 |
-
|------|-----|
|
| 70 |
-
| Sebastian + Jessica v2 | [{LORA_EXAMPLE}]({LORA_EXAMPLE}) |
|
| 71 |
-
|
| 72 |
-
Writeups and sample images live in the GitHub repo under `docs/loras/`.
|
| 73 |
"""
|
| 74 |
|
| 75 |
-
|
| 76 |
-
| Resource | URL |
|
| 77 |
-
|----------|-----|
|
| 78 |
-
| Trainer (GitHub) | {GITHUB} |
|
| 79 |
-
| Lens-Base (Microsoft) | {LENS_BASE} |
|
| 80 |
-
| Microsoft Lens inference | https://github.com/microsoft/Lens |
|
| 81 |
-
| Example dual-character LoRA | {LORA_EXAMPLE} |
|
| 82 |
-
"""
|
| 83 |
-
|
| 84 |
-
with gr.Blocks(title="LoboForge LensTrainer", theme=gr.themes.Soft()) as demo:
|
| 85 |
gr.Markdown(ABOUT)
|
| 86 |
with gr.Tabs():
|
| 87 |
with gr.Tab("Quickstart"):
|
| 88 |
gr.Markdown(QUICKSTART)
|
| 89 |
with gr.Tab("Example LoRAs"):
|
| 90 |
-
gr.Markdown(
|
|
|
|
|
|
|
| 91 |
with gr.Tab("Links"):
|
| 92 |
-
gr.Markdown(
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Hugging Face Space — documentation landing page for LoboForge-LensTrainer."""
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
|
|
|
| 8 |
LENS_BASE = "https://huggingface.co/microsoft/Lens-Base"
|
| 9 |
LORA_EXAMPLE = "https://huggingface.co/LoboForge/lens-lora-sebastian-jessica-v2"
|
| 10 |
|
| 11 |
+
ABOUT = f"""# LoboForge LensTrainer
|
|
|
|
| 12 |
|
| 13 |
Config-driven **LoRA trainer** for [Microsoft Lens-Base]({LENS_BASE}).
|
| 14 |
|
|
|
|
| 20 |
|
| 21 |
**Source code & install:** [{GITHUB}]({GITHUB})
|
| 22 |
|
| 23 |
+
This Space is a **documentation hub**. Clone the repo and run training on your GPU.
|
| 24 |
"""
|
| 25 |
|
| 26 |
+
QUICKSTART = f"""## Install
|
|
|
|
| 27 |
|
| 28 |
```bash
|
| 29 |
git clone {GITHUB}.git
|
|
|
|
| 32 |
pip install -r requirements.txt
|
| 33 |
bash scripts/install_microsoft_lens.sh
|
| 34 |
export PYTHONPATH="$(pwd)/vendor/Lens:$PYTHONPATH"
|
| 35 |
+
huggingface-cli login
|
| 36 |
```
|
| 37 |
|
| 38 |
## Train
|
|
|
|
| 53 |
--output-dir ./output/my-lora \\
|
| 54 |
--resume latest
|
| 55 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
"""
|
| 57 |
|
| 58 |
+
with gr.Blocks(title="LoboForge LensTrainer") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
gr.Markdown(ABOUT)
|
| 60 |
with gr.Tabs():
|
| 61 |
with gr.Tab("Quickstart"):
|
| 62 |
gr.Markdown(QUICKSTART)
|
| 63 |
with gr.Tab("Example LoRAs"):
|
| 64 |
+
gr.Markdown(
|
| 65 |
+
f"**Sebastian + Jessica v2:** [{LORA_EXAMPLE}]({LORA_EXAMPLE})"
|
| 66 |
+
)
|
| 67 |
with gr.Tab("Links"):
|
| 68 |
+
gr.Markdown(
|
| 69 |
+
f"| Resource | URL |\n|---|---|\n"
|
| 70 |
+
f"| GitHub | {GITHUB} |\n"
|
| 71 |
+
f"| Lens-Base | {LENS_BASE} |\n"
|
| 72 |
+
f"| Microsoft Lens | https://github.com/microsoft/Lens |\n"
|
| 73 |
+
)
|