GitHub Action commited on
Commit
f5ced5e
·
1 Parent(s): 1b21038

Sync ling-space changes from GitHub commit 6105973

Browse files
Files changed (4) hide show
  1. app.py +27 -1
  2. i18n/tab_welcome.py +28 -12
  3. static/app.html +0 -4
  4. tab_welcome.py +38 -23
app.py CHANGED
@@ -32,11 +32,37 @@ footer {
32
  }
33
 
34
  /* Disable transition and animation for no-transition class */
35
- .no-transition, .no-transition * {
36
  transition: none !important;
37
  animation: none !important;
38
  animation-play-state: paused !important;
39
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  """
41
 
42
  if __name__ == "__main__":
 
32
  }
33
 
34
  /* Disable transition and animation for no-transition class */
35
+ .no-transition, .no_transition * {
36
  transition: none !important;
37
  animation: none !important;
38
  animation-play-state: paused !important;
39
  }
40
+
41
+ /* Custom CSS for Welcome Tab Centering */
42
+ .welcome-centered-outer {
43
+ height: 100vh; /* Make it take full viewport height */
44
+ display: flex;
45
+ flex-direction: column;
46
+ justify-content: center; /* Center vertically */
47
+ align-items: center; /* Center horizontally */
48
+ text-align: center; /* Center text within the column */
49
+ }
50
+
51
+ .welcome-content-inner {
52
+ max-width: 800px; /* Or whatever appropriate width */
53
+ width: 100%;
54
+ padding: 20px;
55
+ box-sizing: border-box; /* Include padding in width */
56
+ }
57
+
58
+ .language-buttons {
59
+ gap: 10px; /* Space between buttons */
60
+ align-items: center; /* Center buttons within their column */
61
+ }
62
+
63
+ .language-buttons > button {
64
+ width: 240px; /* Example fixed width for buttons */
65
+ }
66
  """
67
 
68
  if __name__ == "__main__":
i18n/tab_welcome.py CHANGED
@@ -6,28 +6,44 @@ ui_translations = {
6
  "zh": "欢迎"
7
  },
8
  "welcome_header": {
9
- "en": "Welcome to Ling Space",
10
- "zh": "欢迎来到 Ling Space"
11
  },
12
  "welcome_description": {
13
- "en": "Experience the power of Ling Series Models through these demos.",
14
- "zh": "通过这些演示体验 Ling 系列模型的能力。"
15
  },
16
  "welcome_chat_desc": {
17
- "en": "Text Generation Chat: Converse with the model naturally.",
18
- "zh": "文本聊天:与模型进行自然对话。"
19
  },
20
  "welcome_code_desc": {
21
- "en": "Code Generation: Generate and preview code snippets.",
22
- "zh": "代码生成:生成并预览代码片段。"
23
  },
24
  "welcome_writer_desc": {
25
- "en": "Smart Writing Assistant: Get help with your writing tasks.",
26
- "zh": "写作助手:获取写作任务的帮助。"
27
  },
28
  "welcome_select_language": {
29
- "en": "Select Language",
30
- "zh": "选择语言"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  },
32
  "lang_en": {
33
  "en": "English",
 
6
  "zh": "欢迎"
7
  },
8
  "welcome_header": {
9
+ "en": "Ling Series Models Demo Space",
10
+ "zh": "Ling 系列模型体验"
11
  },
12
  "welcome_description": {
13
+ "en": "#### Experience the capabilities of Ling series models with these demos:",
14
+ "zh": "#### 通过这些演示体验 Ling 系列模型的能力:"
15
  },
16
  "welcome_chat_desc": {
17
+ "en": """**Chat** - Communicate with the models for various text generation tasks.""",
18
+ "zh": """**文本聊天** - 与模型沟通,完成各种文本生成任务。"""
19
  },
20
  "welcome_code_desc": {
21
+ "en": """**Code Generation** - Generate rich web applications using natural language.""",
22
+ "zh": """**代码生成** - 用自然语言生成效果丰富的 Web 应用并预览。"""
23
  },
24
  "welcome_writer_desc": {
25
+ "en": """**Writing Assistant** - Get help with your writing tasks, leveraging multiple model capabilities.""",
26
+ "zh": """**写作助手** - 综合多种模型能力,提供专业的写作辅助。"""
27
  },
28
  "welcome_select_language": {
29
+ "en": "## Select Language",
30
+ "zh": "## 选择语言"
31
+ },
32
+ "welcome_model_links_header": {
33
+ "en": "## Model Introduction Links",
34
+ "zh": "## 模型介绍链接"
35
+ },
36
+ "welcome_hf_link": {
37
+ "en": "[Ling Series Model Collection](https://huggingface.co/collections/inclusionAI/ling-v2)",
38
+ "zh": "[Ling 系列模型合集](https://huggingface.co/collections/inclusionAI/ling-v2)"
39
+ },
40
+ "welcome_hf_report": {
41
+ "en": "[Ling-1T](https://huggingface.co/inclusionAI/Ling-1T)",
42
+ "zh": "[Ling-1T](https://huggingface.co/inclusionAI/Ling-1T)"
43
+ },
44
+ "welcome_x_account": {
45
+ "en": "X/Twitter: [@AntLingAGI](https://x.com/AntLingAGI)",
46
+ "zh": "X/Twitter: [@AntLingAGI](https://x.com/AntLingAGI)"
47
  },
48
  "lang_en": {
49
  "en": "English",
static/app.html CHANGED
@@ -115,7 +115,6 @@
115
  },
116
  toggle: function () {
117
  // Placeholder for future functionality
118
- SpaceApp.toastInfo("TextGeneratorTab toggled.");
119
  SpaceApp.unloadLastTab();
120
  }
121
  };
@@ -128,7 +127,6 @@
128
  },
129
  toggle: function () {
130
  // Placeholder for future functionality
131
- SpaceApp.toastInfo("WebGeneratorTab toggled.");
132
  SpaceApp.unloadLastTab();
133
  },
134
  toggleFullscreen: function (event) {
@@ -230,12 +228,10 @@
230
  SpaceApp.hasBooted = true;
231
  const currentLang = SpaceApp.detectLanguage();
232
  SpaceApp.setLanguage(currentLang, false);
233
- SpaceApp.toastInfo("Booting Space App...");
234
  SpaceApp.registerEventListeners();
235
  SpaceApp.TextGeneratorTab.init();
236
  SpaceApp.WebGeneratorTab.init();
237
  SpaceApp.WritingAssistantTab.init();
238
- SpaceApp.toastInfo("Space App booted successfully.");
239
  };
240
 
241
  window.SpaceApp = SpaceApp;
 
115
  },
116
  toggle: function () {
117
  // Placeholder for future functionality
 
118
  SpaceApp.unloadLastTab();
119
  }
120
  };
 
127
  },
128
  toggle: function () {
129
  // Placeholder for future functionality
 
130
  SpaceApp.unloadLastTab();
131
  },
132
  toggleFullscreen: function (event) {
 
228
  SpaceApp.hasBooted = true;
229
  const currentLang = SpaceApp.detectLanguage();
230
  SpaceApp.setLanguage(currentLang, false);
 
231
  SpaceApp.registerEventListeners();
232
  SpaceApp.TextGeneratorTab.init();
233
  SpaceApp.WebGeneratorTab.init();
234
  SpaceApp.WritingAssistantTab.init();
 
235
  };
236
 
237
  window.SpaceApp = SpaceApp;
tab_welcome.py CHANGED
@@ -7,26 +7,33 @@ def create_welcome_tab(initial_lang: str):
7
  Returns a dictionary of all component handles that need dynamic updates.
8
  """
9
  with gr.TabItem(get_text("welcome_tab_title", initial_lang)) as welcome_tab:
10
- with gr.Column(elem_classes=["welcome-container"]):
11
- welcome_header_md = gr.Markdown(f"# {get_text('welcome_header', initial_lang)}")
12
- welcome_desc_md = gr.Markdown(get_text('welcome_description', initial_lang))
13
-
14
- with gr.Row():
15
- with gr.Column(scale=1):
16
- welcome_chat_desc_md = gr.Markdown(f"### {get_text('tab_chat', initial_lang)}\n{get_text('welcome_chat_desc', initial_lang)}")
17
- with gr.Column(scale=1):
18
- welcome_code_desc_md = gr.Markdown(f"### {get_text('tab_code', initial_lang)}\n{get_text('welcome_code_desc', initial_lang)}")
19
- with gr.Column(scale=1):
20
- welcome_writer_desc_md = gr.Markdown(f"### {get_text('tab_writer', initial_lang)}\n{get_text('welcome_writer_desc', initial_lang)}")
21
 
22
- gr.Markdown("---")
23
-
24
- with gr.Row():
25
- welcome_lang_select_md = gr.Markdown(f"### {get_text('welcome_select_language', initial_lang)}")
26
-
27
- with gr.Row():
28
- en_button = gr.Button(get_text('lang_en', initial_lang))
29
- zh_button = gr.Button(get_text('lang_zh', initial_lang))
 
 
 
 
 
 
 
 
30
 
31
  en_button.click(
32
  fn=None,
@@ -47,6 +54,10 @@ def create_welcome_tab(initial_lang: str):
47
  "chat_description": welcome_chat_desc_md,
48
  "code_description": welcome_code_desc_md,
49
  "writer_description": welcome_writer_desc_md,
 
 
 
 
50
  "lang_select_header": welcome_lang_select_md,
51
  "en_button": en_button,
52
  "zh_button": zh_button
@@ -62,10 +73,14 @@ def update_language(lang: str, components: dict):
62
  components["tab"]: gr.update(label=get_text("welcome_tab_title", lang)),
63
  components["header"]: gr.update(value=f"# {get_text('welcome_header', lang)}"),
64
  components["description"]: gr.update(value=get_text('welcome_description', lang)),
65
- components["chat_description"]: gr.update(value=f"### {get_text('tab_chat', lang)}\n{get_text('welcome_chat_desc', lang)}"),
66
- components["code_description"]: gr.update(value=f"### {get_text('tab_code', lang)}\n{get_text('welcome_code_desc', lang)}"),
67
- components["writer_description"]: gr.update(value=f"### {get_text('tab_writer', lang)}\n{get_text('welcome_writer_desc', lang)}"),
68
- components["lang_select_header"]: gr.update(value=f"### {get_text('welcome_select_language', lang)}"),
 
 
 
 
69
  components["en_button"]: gr.update(value=get_text('lang_en', lang)),
70
  components["zh_button"]: gr.update(value=get_text('lang_zh', lang)),
71
  }
 
7
  Returns a dictionary of all component handles that need dynamic updates.
8
  """
9
  with gr.TabItem(get_text("welcome_tab_title", initial_lang)) as welcome_tab:
10
+ with gr.Column(elem_classes=["welcome-centered-outer"]):
11
+ with gr.Column(elem_classes=["welcome-content-inner"]):
12
+ welcome_header_md = gr.Markdown(f"# {get_text('welcome_header', initial_lang)}")
13
+ welcome_desc_md = gr.Markdown(get_text('welcome_description', initial_lang))
14
+ with gr.Row(equal_height=True):
15
+ welcome_chat_desc_md = gr.Markdown(get_text('welcome_chat_desc', initial_lang), padding=True, container=True)
16
+ welcome_code_desc_md = gr.Markdown(get_text('welcome_code_desc', initial_lang), padding=True, container=True)
17
+ welcome_writer_desc_md = gr.Markdown(get_text('welcome_writer_desc', initial_lang), padding=True, container=True)
18
+
19
+ gr.Markdown(" ")
 
20
 
21
+ with gr.Row():
22
+ welcome_model_links_header_md = gr.Markdown(get_text('welcome_model_links_header', initial_lang))
23
+ with gr.Row():
24
+ welcome_hf_link_md = gr.Markdown(get_text('welcome_hf_link', initial_lang), padding=True, container=True)
25
+ welcome_hf_report_md = gr.Markdown(get_text('welcome_hf_report', initial_lang), padding=True, container=True)
26
+ welcome_x_account_md = gr.Markdown(get_text('welcome_x_account', initial_lang), padding=True, container=True)
27
+
28
+ gr.Markdown(" ")
29
+
30
+ with gr.Row():
31
+ welcome_lang_select_md = gr.Markdown(get_text('welcome_select_language', initial_lang))
32
+
33
+ with gr.Row():
34
+ with gr.Column(elem_classes=["language-buttons"]):
35
+ en_button = gr.Button(get_text('lang_en', initial_lang))
36
+ zh_button = gr.Button(get_text('lang_zh', initial_lang))
37
 
38
  en_button.click(
39
  fn=None,
 
54
  "chat_description": welcome_chat_desc_md,
55
  "code_description": welcome_code_desc_md,
56
  "writer_description": welcome_writer_desc_md,
57
+ "model_links_header": welcome_model_links_header_md,
58
+ "hf_link": welcome_hf_link_md,
59
+ "hf_report": welcome_hf_report_md,
60
+ "x_account": welcome_x_account_md,
61
  "lang_select_header": welcome_lang_select_md,
62
  "en_button": en_button,
63
  "zh_button": zh_button
 
73
  components["tab"]: gr.update(label=get_text("welcome_tab_title", lang)),
74
  components["header"]: gr.update(value=f"# {get_text('welcome_header', lang)}"),
75
  components["description"]: gr.update(value=get_text('welcome_description', lang)),
76
+ components["chat_description"]: gr.update(value=get_text('welcome_chat_desc', lang)),
77
+ components["code_description"]: gr.update(value=get_text('welcome_code_desc', lang)),
78
+ components["writer_description"]: gr.update(value=get_text('welcome_writer_desc', lang)),
79
+ components["model_links_header"]: gr.update(value=get_text('welcome_model_links_header', lang)),
80
+ components["hf_link"]: gr.update(value=get_text('welcome_hf_link', lang)),
81
+ components["hf_report"]: gr.update(value=get_text('welcome_hf_report', lang)),
82
+ components["x_account"]: gr.update(value=get_text('welcome_x_account', lang)),
83
+ components["lang_select_header"]: gr.update(value=get_text('welcome_select_language', lang)),
84
  components["en_button"]: gr.update(value=get_text('lang_en', lang)),
85
  components["zh_button"]: gr.update(value=get_text('lang_zh', lang)),
86
  }