File size: 961 Bytes
6e67bdd
 
 
 
 
 
 
 
a307bc1
6e67bdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a7de579
6e67bdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
from huggingface_hub import HfApi

STATUS_CHOICES = [
    'RUNNING',
    'PAUSED',
    'STOPPED',
    'RUNTIME_ERROR',
    'BUILD_ERROR',
    'CONFIG_ERROR',
    'BUILDING',
    'RUNNING_BUILDING',
    'NO_APP_FILE',
]
HARDWARE_CHOICES = [
    'cpu-basic',
    'cpu-upgrade',
    't4-small',
    't4-medium',
    'zero-a10g',
    'a10g-small',
    'a10g-large',
    'a100-large',
]
SDK_CHOICES = [
    'gradio',
    'streamlit',
    'docker',
]
SLEEP_TIME_INT_TO_STR = {
    0: 'null',
    300: '5 minutes',
    900: '15 minutes',
    1800: '30 minutes',
    3600: '1 hour',
    36000: '10 hours',
    86400: '24 hours',
    172800: '48 hours',
    259200: '72 hours',
    604800: '1 week',
}
SLEEP_TIME_CHOICES = list(SLEEP_TIME_INT_TO_STR.values())
SLEEP_TIME_STR_TO_INT = {v: k for k, v in SLEEP_TIME_INT_TO_STR.items()}

VISIBILITY_CHOICES = ['public', 'private']

api = HfApi()
WHOAMI = api.whoami()['name']
OWNER_CHOICES = [WHOAMI, 'other organizations']