openfree commited on
Commit
44061da
·
verified ·
1 Parent(s): a0c3b88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +86 -100
app.py CHANGED
@@ -1007,117 +1007,106 @@ The response should be in HTML format with appropriate styling."""
1007
  </style>
1008
 
1009
 
1010
- header = gr.HTML("""
1011
- <div class="window-frame">
1012
- <div class="window-header">
1013
- <div class="window-controls">
1014
- <div class="control close"></div>
1015
- <div class="control minimize"></div>
1016
- <div class="control maximize"></div>
1017
- </div>
1018
- <div class="window-title">
1019
- <div class="window-address">
1020
- <div class="secure-icon">🔒</div>
1021
- <div class="url-bar">https://VIDraft-mouse-chat.hf.space</div>
1022
- </div>
1023
- </div>
1024
- </div>
1025
- <div class="app-content">
1026
- <img src="data:image/gif;base64,{}" width="360px" />
1027
- <h1 class="app-title">MOUSE-Chat Visual AI</h1>
1028
- <p class="app-description">Creates visualized web pages from text input, and when you include keywords like "image:", "그림:", or "image:" in your input, it automatically generates AI images based on the description and incorporates them into the web page.
1029
- Use the "Generate" button for basic creation, "Enhance" button for prompt improvement, "Share" button to deploy results to the web, and input like "image: a dog playing in the park" to create results containing both text and generated images.</p>
1030
- </div>
1031
  </div>
1032
- """.format(get_image_base64('mouse.gif')))
1033
-
1034
- # 입력 영역
1035
- input = antd.InputTextarea(
1036
- size="large",
1037
- allow_clear=True,
1038
- placeholder=get_random_placeholder(),
1039
- elem_classes="custom-textarea"
1040
- )
1041
-
1042
- # 버튼 그룹
1043
- with antd.Flex(gap="small", justify="flex-start"):
1044
- btn = antd.Button(
1045
- "Generate",
1046
- type="primary",
1047
- size="large",
1048
- elem_classes="generate-btn"
1049
- )
1050
- boost_btn = antd.Button(
1051
- "Enhance",
1052
- type="default",
1053
- size="large",
1054
- elem_classes="enhance-btn"
1055
- )
1056
- deploy_btn = antd.Button(
1057
- "Share",
1058
- type="default",
1059
- size="large",
1060
- elem_classes="share-btn"
1061
- )
1062
-
1063
- deploy_result = gr.HTML(
1064
- label="Share Result",
1065
- elem_classes="deploy-result"
1066
- )
1067
 
1068
- # 우측 패널
1069
- with antd.Col(span=24, md=16):
1070
- with ms.Div(elem_classes="right_panel"):
 
 
 
1071
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1072
 
 
 
 
 
1073
 
1074
- # macOS 스타일 윈도우 헤더
1075
- gr.HTML("""
1076
- <div class="window-frame">
1077
- <div class="window-header">
1078
- <div class="window-controls">
1079
- <div class="control close"></div>
1080
- <div class="control minimize"></div>
1081
- <div class="control maximize"></div>
1082
- </div>
1083
- <div class="window-title">Preview</div>
1084
  </div>
 
1085
  </div>
1086
- """)
1087
-
1088
- # 탭 컨텐츠
1089
- with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
1090
- with antd.Tabs.Item(key="empty"):
1091
- empty = antd.Empty(
1092
- description="Enter your question to begin",
1093
- elem_classes="right_content empty-content"
1094
- )
1095
-
1096
- with antd.Tabs.Item(key="loading"):
1097
- loading = antd.Spin(
1098
- True,
1099
- tip="Creating visual presentation...",
1100
- size="large",
1101
- elem_classes="right_content"
1102
- )
1103
-
1104
- with antd.Tabs.Item(key="render"):
1105
- sandbox = gr.HTML(elem_classes="html_content")
1106
-
1107
- with antd.Tabs.Item(key="error"):
1108
- error = antd.Empty(
1109
- description="An error occurred. Please try again.",
1110
- elem_classes="right_content error-content"
1111
- )
1112
 
1113
- # 모드 변경 이벤트
1114
  mode.change(
1115
  fn=lambda x: x == "Generate + Web Search",
1116
  inputs=[mode],
1117
  outputs=[search_mode]
1118
  )
1119
 
1120
- # 버튼 이벤트 핸들러
1121
  btn.click(
1122
  fn=handle_generation,
1123
  inputs=[input, setting, search_mode],
@@ -1166,7 +1155,6 @@ header = gr.HTML("""
1166
  color: #4285f4 !important;
1167
  }
1168
 
1169
- /* hover 효과 */
1170
  .generate-btn:hover {
1171
  background: #0056b3 !important;
1172
  }
@@ -1187,8 +1175,6 @@ header = gr.HTML("""
1187
 
1188
  return demo
1189
 
1190
-
1191
- # 메인 실행 부분
1192
  if __name__ == "__main__":
1193
  try:
1194
  demo_instance = Demo()
 
1007
  </style>
1008
 
1009
 
1010
+ header = gr.HTML("""
1011
+ <div class="window-frame">
1012
+ <div class="window-header">
1013
+ <div class="window-controls">
1014
+ <div class="control close"></div>
1015
+ <div class="control minimize"></div>
1016
+ <div class="control maximize"></div>
1017
+ </div>
1018
+ <div class="window-title">
1019
+ <div class="window-address">
1020
+ <div class="secure-icon">🔒</div>
1021
+ <div class="url-bar">https://VIDraft-mouse-chat.hf.space</div>
 
 
 
 
 
 
 
 
 
1022
  </div>
1023
+ </div>
1024
+ </div>
1025
+ <div class="app-content">
1026
+ <img src="data:image/gif;base64,{}" width="360px" />
1027
+ <h1 class="app-title">MOUSE-Chat Visual AI</h1>
1028
+ <p class="app-description">Creates visualized web pages from text input...</p>
1029
+ </div>
1030
+ </div>
1031
+ """.format(get_image_base64('mouse.gif')))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1032
 
1033
+ input = antd.InputTextarea(
1034
+ size="large",
1035
+ allow_clear=True,
1036
+ placeholder=get_random_placeholder(),
1037
+ elem_classes="custom-textarea"
1038
+ )
1039
 
1040
+ with antd.Flex(gap="small", justify="flex-start"):
1041
+ btn = antd.Button(
1042
+ "Generate",
1043
+ type="primary",
1044
+ size="large",
1045
+ elem_classes="generate-btn"
1046
+ )
1047
+ boost_btn = antd.Button(
1048
+ "Enhance",
1049
+ type="default",
1050
+ size="large",
1051
+ elem_classes="enhance-btn"
1052
+ )
1053
+ deploy_btn = antd.Button(
1054
+ "Share",
1055
+ type="default",
1056
+ size="large",
1057
+ elem_classes="share-btn"
1058
+ )
1059
 
1060
+ deploy_result = gr.HTML(
1061
+ label="Share Result",
1062
+ elem_classes="deploy-result"
1063
+ )
1064
 
1065
+ with antd.Col(span=24, md=16):
1066
+ with ms.Div(elem_classes="right_panel"):
1067
+ gr.HTML("""
1068
+ <div class="window-frame">
1069
+ <div class="window-header">
1070
+ <div class="window-controls">
1071
+ <div class="control close"></div>
1072
+ <div class="control minimize"></div>
1073
+ <div class="control maximize"></div>
 
1074
  </div>
1075
+ <div class="window-title">Preview</div>
1076
  </div>
1077
+ </div>
1078
+ """)
1079
+
1080
+ with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
1081
+ with antd.Tabs.Item(key="empty"):
1082
+ empty = antd.Empty(
1083
+ description="Enter your question to begin",
1084
+ elem_classes="right_content empty-content"
1085
+ )
1086
+
1087
+ with antd.Tabs.Item(key="loading"):
1088
+ loading = antd.Spin(
1089
+ True,
1090
+ tip="Creating visual presentation...",
1091
+ size="large",
1092
+ elem_classes="right_content"
1093
+ )
1094
+
1095
+ with antd.Tabs.Item(key="render"):
1096
+ sandbox = gr.HTML(elem_classes="html_content")
1097
+
1098
+ with antd.Tabs.Item(key="error"):
1099
+ error = antd.Empty(
1100
+ description="An error occurred. Please try again.",
1101
+ elem_classes="right_content error-content"
1102
+ )
1103
 
 
1104
  mode.change(
1105
  fn=lambda x: x == "Generate + Web Search",
1106
  inputs=[mode],
1107
  outputs=[search_mode]
1108
  )
1109
 
 
1110
  btn.click(
1111
  fn=handle_generation,
1112
  inputs=[input, setting, search_mode],
 
1155
  color: #4285f4 !important;
1156
  }
1157
 
 
1158
  .generate-btn:hover {
1159
  background: #0056b3 !important;
1160
  }
 
1175
 
1176
  return demo
1177
 
 
 
1178
  if __name__ == "__main__":
1179
  try:
1180
  demo_instance = Demo()