ginipick commited on
Commit
ea30dcf
·
verified ·
1 Parent(s): cf21b55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -27
app.py CHANGED
@@ -148,7 +148,11 @@ def create_ui():
148
  }
149
  .scroll-lock {
150
  overflow: auto !important;
151
- max-height: 400px !important;
 
 
 
 
152
  }
153
  """
154
 
@@ -180,7 +184,7 @@ def create_ui():
180
  )
181
 
182
  with gr.Column(scale=4): # 오른쪽 40%
183
- with gr.Group(elem_classes="output-group scroll-lock"):
184
  code_tabs = gr.Tabs()
185
  with code_tabs:
186
  app_py_tab = gr.TabItem("app.py")
@@ -220,38 +224,16 @@ def create_ui():
220
  outputs=[file_buttons]
221
  )
222
 
223
- demo.load(None, None, None, _js="""
224
- function openFile(path, spaceId) {
225
- const event = new CustomEvent('open-file', { detail: { path, spaceId } });
226
- window.dispatchEvent(event);
227
- }
228
- """)
229
-
230
  file_path_input = gr.Textbox(visible=False)
231
  space_id_input = gr.Textbox(visible=False)
232
 
233
  def handle_file_open(file_path, space_id):
234
  return file_path, space_id
235
 
236
- demo.load(handle_file_open, [file_path_input, space_id_input], [file_path_input, space_id_input], _js="""
237
- function(file_path_input, space_id_input) {
238
- function handleOpenFile(event) {
239
- const { path, spaceId } = event.detail;
240
- file_path_input.value = path;
241
- space_id_input.value = spaceId;
242
- file_path_input.dispatchEvent(new Event('change'));
243
- space_id_input.dispatchEvent(new Event('change'));
244
- }
245
- window.addEventListener('open-file', handleOpenFile);
246
- return [file_path_input, space_id_input];
247
- }
248
- """)
249
-
250
  file_path_input.change(
251
  open_file,
252
  inputs=[file_path_input, space_id_input],
253
- outputs=[code_tabs, code_tabs],
254
- _js="(path, spaceId) => [path, spaceId]"
255
  )
256
 
257
  return demo
@@ -264,8 +246,8 @@ def create_ui():
264
  if __name__ == "__main__":
265
  try:
266
  demo = create_ui()
 
267
  demo.launch()
268
  except Exception as e:
269
  print(f"Error in main: {str(e)}")
270
- print(traceback.format_exc())
271
-
 
148
  }
149
  .scroll-lock {
150
  overflow: auto !important;
151
+ max-height: none !important;
152
+ height: calc(100vh - 200px) !important;
153
+ }
154
+ .full-height {
155
+ height: calc(100vh - 200px) !important;
156
  }
157
  """
158
 
 
184
  )
185
 
186
  with gr.Column(scale=4): # 오른쪽 40%
187
+ with gr.Group(elem_classes="output-group scroll-lock full-height"):
188
  code_tabs = gr.Tabs()
189
  with code_tabs:
190
  app_py_tab = gr.TabItem("app.py")
 
224
  outputs=[file_buttons]
225
  )
226
 
 
 
 
 
 
 
 
227
  file_path_input = gr.Textbox(visible=False)
228
  space_id_input = gr.Textbox(visible=False)
229
 
230
  def handle_file_open(file_path, space_id):
231
  return file_path, space_id
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  file_path_input.change(
234
  open_file,
235
  inputs=[file_path_input, space_id_input],
236
+ outputs=[code_tabs, code_tabs]
 
237
  )
238
 
239
  return demo
 
246
  if __name__ == "__main__":
247
  try:
248
  demo = create_ui()
249
+ demo.queue()
250
  demo.launch()
251
  except Exception as e:
252
  print(f"Error in main: {str(e)}")
253
+ print(traceback.format_exc())