ginipick commited on
Commit
c49fd90
·
verified ·
1 Parent(s): d2b005e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -14
app.py CHANGED
@@ -177,7 +177,6 @@ def respond(
177
 
178
 
179
 
180
-
181
  def create_ui():
182
  try:
183
  css = """
@@ -201,6 +200,18 @@ def create_ui():
201
  }
202
  """
203
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
205
  gr.Markdown("# HuggingFace Space Analyzer")
206
 
@@ -323,6 +334,9 @@ def create_ui():
323
  outputs=[code_tabs, code_tabs]
324
  )
325
 
 
 
 
326
  return demo
327
 
328
  except Exception as e:
@@ -337,19 +351,8 @@ if __name__ == "__main__":
337
  demo.launch(
338
  share=False,
339
  debug=True,
340
- show_api=False,
341
- js="""
342
- function openFile(path, spaceId) {
343
- const filePathInput = document.querySelector('input[data-testid="file_path_input"]');
344
- const spaceIdInput = document.querySelector('input[data-testid="space_id_input"]');
345
- if (filePathInput && spaceIdInput) {
346
- filePathInput.value = path;
347
- spaceIdInput.value = spaceId;
348
- filePathInput.dispatchEvent(new Event('change'));
349
- }
350
- }
351
- """
352
  )
353
  except Exception as e:
354
  print(f"Error in main: {str(e)}")
355
- print(traceback.format_exc())
 
177
 
178
 
179
 
 
180
  def create_ui():
181
  try:
182
  css = """
 
200
  }
201
  """
202
 
203
+ js = """
204
+ function openFile(path, spaceId) {
205
+ const filePathInput = document.querySelector('input[data-testid="file_path_input"]');
206
+ const spaceIdInput = document.querySelector('input[data-testid="space_id_input"]');
207
+ if (filePathInput && spaceIdInput) {
208
+ filePathInput.value = path;
209
+ spaceIdInput.value = spaceId;
210
+ filePathInput.dispatchEvent(new Event('change'));
211
+ }
212
+ }
213
+ """
214
+
215
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
216
  gr.Markdown("# HuggingFace Space Analyzer")
217
 
 
334
  outputs=[code_tabs, code_tabs]
335
  )
336
 
337
+ # JavaScript 코드를 HTML에 직접 삽입
338
+ gr.HTML(f"<script>{js}</script>")
339
+
340
  return demo
341
 
342
  except Exception as e:
 
351
  demo.launch(
352
  share=False,
353
  debug=True,
354
+ show_api=False
 
 
 
 
 
 
 
 
 
 
 
355
  )
356
  except Exception as e:
357
  print(f"Error in main: {str(e)}")
358
+ print(traceback.format_exc())