42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from ..Web.pytorch import *
|
|
from ..Instance import *
|
|
|
|
|
|
class NumericMenu:
|
|
|
|
@staticmethod
|
|
def print_menu(items: list[str], prompt: str = "Choise: ") -> int:
|
|
for i in range(len(items)): print(f'{i + 1}. {items[i]}')
|
|
return int(input(prompt))
|
|
|
|
@classmethod
|
|
def menu_create_instance_generic_pytorch_application(cls):
|
|
api = input("Type your api version code. Ex. cu121 for cuda 12.1: ")
|
|
t = pytorch.versions_torch(api)
|
|
choise = cls.print_menu(t, "torch version: ")
|
|
t = t[choise - 1]
|
|
tv = pytorch.versions_torchvision(api)
|
|
choise = cls.print_menu(tv, "torchvision version: ")
|
|
tv = tv[choise - 1]
|
|
ta = pytorch.versions_torchaudio(api)
|
|
choise = cls.print_menu(ta, "torchaudio version: ")
|
|
ta = ta[choise - 1]
|
|
print("Pytorch version:", t, "torchvision:", tv, "torchaudio:", ta)
|
|
path = input("Instance path: ")
|
|
instance = GenericPytorchInstance(path, api, t, tv, ta)
|
|
|
|
@classmethod
|
|
def menu_create_instance(cls):
|
|
choise = cls.print_menu(['Generic PyTorch Application', 'ComfyUI', 'Stable Diffusion Forge'])
|
|
if choise == 1: cls.menu_create_instance_generic_pytorch_application()
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
def start(cls):
|
|
choise = cls.print_menu(['Create instance'])
|
|
if choise == 1:
|
|
cls.menu_create_instance()
|
|
|