Spaces:
Runtime error
Runtime error
Commit
Β·
2c73b7e
1
Parent(s):
4103281
[docs] placeholder docs in app
Browse files- README.md +1 -1
- src/axolotl_ui/app.py +3 -2
- src/axolotl_ui/utils.py +22 -4
README.md
CHANGED
@@ -8,7 +8,7 @@ pinned: false
|
|
8 |
license: apache-2.0
|
9 |
---
|
10 |
|
11 |
-
Note: This is filler text for now, but the app will be a fine-tuning app for Hugging Face models. It will allow users to easily fine-tune models on their own datasets using Hugging Face's infrastructure
|
12 |
|
13 |
## Getting Started with Your Fine-Tuning App on Hugging Face Spaces
|
14 |
|
|
|
8 |
license: apache-2.0
|
9 |
---
|
10 |
|
11 |
+
**Note: This is filler text for now, but the app will be a fine-tuning app for Hugging Face models. It will allow users to easily fine-tune models on their own datasets using Hugging Face's infrastructure.**
|
12 |
|
13 |
## Getting Started with Your Fine-Tuning App on Hugging Face Spaces
|
14 |
|
src/axolotl_ui/app.py
CHANGED
@@ -4,7 +4,7 @@ from shiny import App, Inputs, Outputs, Session, ui, reactive
|
|
4 |
import shinyswatch
|
5 |
from htmltools import HTML
|
6 |
|
7 |
-
from utils import background_img, question_circle_fill
|
8 |
|
9 |
|
10 |
www_dir = Path(__file__).parent.resolve() / "www"
|
@@ -97,7 +97,8 @@ app_ui = ui.page_fillable(
|
|
97 |
class_="opacity-75"
|
98 |
),
|
99 |
HTML(background_img(url="https://github.com/OpenAccess-AI-Collective/axolotl/raw/main/image/axolotl.png",
|
100 |
-
opacity=0.1))
|
|
|
101 |
)
|
102 |
)
|
103 |
|
|
|
4 |
import shinyswatch
|
5 |
from htmltools import HTML
|
6 |
|
7 |
+
from utils import background_img, question_circle_fill, read_markdown_file
|
8 |
|
9 |
|
10 |
www_dir = Path(__file__).parent.resolve() / "www"
|
|
|
97 |
class_="opacity-75"
|
98 |
),
|
99 |
HTML(background_img(url="https://github.com/OpenAccess-AI-Collective/axolotl/raw/main/image/axolotl.png",
|
100 |
+
opacity=0.1)),
|
101 |
+
ui.markdown(read_markdown_file(path="README.md"))
|
102 |
)
|
103 |
)
|
104 |
|
src/axolotl_ui/utils.py
CHANGED
@@ -1,15 +1,17 @@
|
|
1 |
from shiny import ui
|
2 |
|
|
|
3 |
# https://icons.getbootstrap.com/icons/question-circle-fill/
|
4 |
-
def question_circle_fill():
|
5 |
ui.HTML(
|
6 |
-
|
7 |
)
|
8 |
|
|
|
9 |
def background_img(url: str, opacity: float) -> str:
|
10 |
"""
|
11 |
Generate CSS style for setting a somewhat transparent background image.
|
12 |
-
|
13 |
Parameters
|
14 |
----------
|
15 |
url : str
|
@@ -45,4 +47,20 @@ def background_img(url: str, opacity: float) -> str:
|
|
45 |
height: 100%;
|
46 |
}}
|
47 |
</style>
|
48 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from shiny import ui
|
2 |
|
3 |
+
|
4 |
# https://icons.getbootstrap.com/icons/question-circle-fill/
|
5 |
+
def question_circle_fill() -> str:
|
6 |
ui.HTML(
|
7 |
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-question-circle-fill mb-1" viewBox="0 0 16 16"><path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247zm2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z"/></svg>'
|
8 |
)
|
9 |
|
10 |
+
|
11 |
def background_img(url: str, opacity: float) -> str:
|
12 |
"""
|
13 |
Generate CSS style for setting a somewhat transparent background image.
|
14 |
+
|
15 |
Parameters
|
16 |
----------
|
17 |
url : str
|
|
|
47 |
height: 100%;
|
48 |
}}
|
49 |
</style>
|
50 |
+
"""
|
51 |
+
|
52 |
+
|
53 |
+
def read_markdown_file(path):
|
54 |
+
with open(path, 'r') as file:
|
55 |
+
lines = file.readlines()
|
56 |
+
|
57 |
+
# Find the start and end of the YAML header
|
58 |
+
yaml_delimiters = [i for i, line in enumerate(lines) if line.strip() == '---']
|
59 |
+
|
60 |
+
# Skip the YAML header if it exists (assuming there are two delimiters)
|
61 |
+
if len(yaml_delimiters) == 2:
|
62 |
+
content_start = yaml_delimiters[1] + 1
|
63 |
+
return ''.join(lines[content_start:])
|
64 |
+
else:
|
65 |
+
# No YAML header found, return the entire content
|
66 |
+
return ''.join(lines)
|