Aitron Emper commited on
Commit
5bb7514
1 Parent(s): b9e3c01

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -42
app.py CHANGED
@@ -1,42 +1,15 @@
1
  import gradio as gr
2
  import sys
3
  import os
 
 
 
 
4
 
5
  now_dir = os.getcwd()
6
  sys.path.append(now_dir)
7
 
8
-
9
- class InstallationError(Exception):
10
- def __init__(self, message="InstallationError"):
11
- self.message = message
12
- super().__init__(self.message)
13
-
14
-
15
- try:
16
- system_drive = os.getenv("SystemDrive")
17
- current_drive = os.path.splitdrive(now_dir)[0]
18
- if current_drive.upper() != system_drive.upper():
19
- raise InstallationError(
20
- f"Error: Current working directory is not on the default system drive ({system_drive}). Please move Applio in the correct drive."
21
- )
22
- except:
23
- pass
24
- else:
25
- if "OneDrive" in now_dir:
26
- raise InstallationError(
27
- "Error: Current working directory is on OneDrive. Please move Applio in another folder."
28
- )
29
- elif " " in now_dir:
30
- raise InstallationError(
31
- "Error: Current working directory contains spaces. Please move Applio in another folder."
32
- )
33
- try:
34
- now_dir.encode("ascii")
35
- except UnicodeEncodeError:
36
- raise InstallationError(
37
- "Error: Current working directory contains non-ASCII characters. Please move Applio in another folder."
38
- )
39
-
40
  from tabs.inference.inference import inference_tab
41
  from tabs.train.train import train_tab
42
  from tabs.extra.extra import extra_tab
@@ -45,16 +18,21 @@ from tabs.download.download import download_tab
45
  from tabs.tts.tts import tts_tab
46
  from tabs.settings.presence import presence_tab
47
  from tabs.settings.themes import theme_tab
 
48
 
 
49
  import assets.themes.loadThemes as loadThemes
50
-
51
  from assets.i18n.i18n import I18nAuto
52
-
53
- i18n = I18nAuto()
54
-
55
  from assets.discord_presence import RPCManager
 
56
 
 
 
57
  RPCManager.start_presence()
 
 
 
58
 
59
  my_applio = loadThemes.load_json()
60
  if my_applio:
@@ -77,8 +55,8 @@ with gr.Blocks(theme=my_applio, title="Applio") as Applio:
77
  with gr.Tab(i18n("Inference")):
78
  inference_tab()
79
 
80
- # with gr.Tab(i18n("Train")):
81
- # train_tab()
82
 
83
  with gr.Tab(i18n("TTS")):
84
  tts_tab()
@@ -86,16 +64,24 @@ with gr.Blocks(theme=my_applio, title="Applio") as Applio:
86
  with gr.Tab(i18n("Extra")):
87
  extra_tab()
88
 
 
 
 
89
  with gr.Tab(i18n("Download")):
90
  download_tab()
91
 
92
  with gr.Tab(i18n("Report a Bug")):
93
  report_tab()
94
 
95
- # with gr.Tab(i18n("Settings")):
96
- # presence_tab()
97
- # theme_tab()
98
 
99
 
100
  if __name__ == "__main__":
101
- Applio.launch()
 
 
 
 
 
 
1
  import gradio as gr
2
  import sys
3
  import os
4
+ import logging
5
+ import time
6
+ import threading
7
+ import shutil
8
 
9
  now_dir = os.getcwd()
10
  sys.path.append(now_dir)
11
 
12
+ # Tabs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  from tabs.inference.inference import inference_tab
14
  from tabs.train.train import train_tab
15
  from tabs.extra.extra import extra_tab
 
18
  from tabs.tts.tts import tts_tab
19
  from tabs.settings.presence import presence_tab
20
  from tabs.settings.themes import theme_tab
21
+ from tabs.plugins.plugins import plugins_tab
22
 
23
+ # Assets
24
  import assets.themes.loadThemes as loadThemes
 
25
  from assets.i18n.i18n import I18nAuto
26
+ import assets.installation_checker as installation_checker
 
 
27
  from assets.discord_presence import RPCManager
28
+ import assets.delete_models as delete_models
29
 
30
+ delete_models.start_infinite_loop()
31
+ i18n = I18nAuto()
32
  RPCManager.start_presence()
33
+ installation_checker.check_installation()
34
+ logging.getLogger("uvicorn").disabled = True
35
+ logging.getLogger("fairseq").disabled = True
36
 
37
  my_applio = loadThemes.load_json()
38
  if my_applio:
 
55
  with gr.Tab(i18n("Inference")):
56
  inference_tab()
57
 
58
+ with gr.Tab(i18n("Train")):
59
+ train_tab()
60
 
61
  with gr.Tab(i18n("TTS")):
62
  tts_tab()
 
64
  with gr.Tab(i18n("Extra")):
65
  extra_tab()
66
 
67
+ with gr.Tab(i18n("Plugins")):
68
+ plugins_tab()
69
+
70
  with gr.Tab(i18n("Download")):
71
  download_tab()
72
 
73
  with gr.Tab(i18n("Report a Bug")):
74
  report_tab()
75
 
76
+ with gr.Tab(i18n("Settings")):
77
+ presence_tab()
78
+ theme_tab()
79
 
80
 
81
  if __name__ == "__main__":
82
+ Applio.launch(
83
+ favicon_path="assets/ICON.ico",
84
+ share="--share" in sys.argv,
85
+ inbrowser="--open" in sys.argv,
86
+ server_port=6969,
87
+ )