File size: 1,074 Bytes
f4f6aba
 
 
 
 
 
dd68837
 
 
 
31a1df6
 
dd68837
31a1df6
dd68837
 
 
 
 
 
 
 
 
31a1df6
 
 
dd68837
 
 
 
 
 
 
 
 
 
31a1df6
dd68837
31a1df6
dd68837
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""The app.py used with streamlit

This ties together the different parts of the app.

"""

from pathlib import Path
from tempfile import mkdtemp
from typing import Literal

import streamlit as st

from create import create_repo_input_form
from edit import edit_input_form
from start import start_input_form


# Create a hf_path, which is where the repo will be created locally. When the
# session is created, copy the dummy cat.png file there and make it the cwd
if "hf_path" not in st.session_state:
    hf_path = Path(mkdtemp(prefix="skops-"))
    st.session_state.hf_path = hf_path


st.header("Skops model card creator")


class Screen:
    state: Literal["start", "edit", "create_repo"] = "start"


if "screen" not in st.session_state:
    st.session_state.screen: Screen = Screen()


if st.session_state.screen.state == "start":
    start_input_form()
elif st.session_state.screen.state == "edit":
    edit_input_form()
elif st.session_state.screen.state == "create_repo":
    create_repo_input_form()
else:
    st.write("Something went wrong, please open an issue")