File size: 964 Bytes
bbea1cc
 
cb5b71d
 
 
 
bbea1cc
 
 
 
 
 
cb5b71d
 
 
bbea1cc
 
 
 
 
 
 
 
 
 
 
 
 
 
cb5b71d
dc92053
 
 
 
 
edf454b
dc92053
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
import os

from etils import epath

import mlcroissant as mlc

# Authentication to Hugging Face:
REDIRECT_URI = os.getenv("REDIRECT_URI", "http://localhost:8501")
OAUTH_STATE = os.getenv("OAUTH_STATE")
OAUTH_CLIENT_ID = os.getenv("OAUTH_CLIENT_ID")
OAUTH_CLIENT_SECRET = os.getenv("OAUTH_CLIENT_SECRET")

EDITOR_CACHE: epath.Path = mlc.constants.CROISSANT_CACHE / "editor"


def PAST_PROJECTS_PATH(user) -> epath.Path:
    base = EDITOR_CACHE / "projects"
    # If there is authentication, look up in the user's path:
    if OAUTH_CLIENT_ID:
        if user is None:
            raise Exception("Please, authenticate before using the application.")
        return base / user.username
    # Else look up at the root:
    else:
        return base


PROJECT_FOLDER_PATTERN = "%Y%m%d%H%M%S%f"

DF_HEIGHT = 150

# Tabs
OVERVIEW = "Overview"
METADATA = "Metadata"
RESOURCES = "Resources"
RECORD_SETS = "Record Sets"
TABS = [OVERVIEW, METADATA, RESOURCES, RECORD_SETS]