PraneshJs commited on
Commit
863bf01
·
verified ·
1 Parent(s): 96dfefe

changed ui

Browse files
Files changed (1) hide show
  1. app.py +31 -85
app.py CHANGED
@@ -332,89 +332,41 @@ export default Demo
332
 
333
  # ---------- CSS ----------
334
  css = """
335
- /* Full screen container adjustments */
336
- .gradio-container {
337
- max-width: 100% !important;
338
- padding: 0 !important;
 
 
 
339
  }
340
-
341
- #coder-artifacts {
342
- min-height: 100vh;
343
- padding: 1rem;
344
- }
345
-
346
- /* Output container adjustments */
347
- #coder-artifacts .output-empty,
348
- #coder-artifacts .output-loading {
349
- display: flex;
350
- flex-direction: column;
351
- align-items: center;
352
- justify-content: center;
353
- width: 100%;
354
- min-height: 85vh;
355
- }
356
-
357
- #coder-artifacts #output-container {
358
- height: 85vh !important;
359
- }
360
-
361
- #coder-artifacts #output-container .ms-gr-ant-tabs-content,
362
- #coder-artifacts #output-container .ms-gr-ant-tabs-tabpane {
363
  height: 100%;
364
  }
365
-
366
  #coder-artifacts .output-html {
367
- display: flex;
368
- flex-direction: column;
369
- width: 100%;
370
- height: 100%;
371
- min-height: 85vh;
372
  }
373
-
374
  #coder-artifacts .output-html > iframe {
375
- flex: 1;
376
- min-height: 85vh;
377
  }
378
-
379
- /* Code drawer adjustments */
380
- #coder-artifacts-code-drawer {
381
- height: 100vh !important;
382
- }
383
-
384
  #coder-artifacts-code-drawer .output-code {
385
- flex: 1;
386
- height: 100%;
387
  }
388
-
389
  #coder-artifacts-code-drawer .output-code .ms-gr-ant-spin-nested-loading {
390
- min-height: 100%;
391
- }
392
-
393
- /* History drawer adjustments */
394
- .history_chatbot {
395
- height: 85vh !important;
396
- }
397
-
398
- /* Responsive adjustments */
399
- @media (max-width: 768px) {
400
- #coder-artifacts {
401
- padding: 0.5rem;
402
- }
403
-
404
- #coder-artifacts #output-container,
405
- #coder-artifacts .output-html,
406
- #coder-artifacts .output-html > iframe {
407
- min-height: 70vh;
408
- }
409
  }
410
  """
411
 
412
- # ---------- GRADIO UI ----------
413
  with gr.Blocks(css=css) as demo:
414
  # Global State
415
  state = gr.State({"system_prompt": "", "history": []})
416
  with ms.Application(elem_id="coder-artifacts") as app:
417
  with antd.ConfigProvider(theme=DEFAULT_THEME, locale=DEFAULT_LOCALE):
 
418
  with ms.AutoLoading():
419
  with antd.Row(gutter=[32, 12],
420
  elem_style=dict(marginTop=20),
@@ -432,7 +384,7 @@ with gr.Blocks(css=css) as demo:
432
  # height=200,
433
  # preview=False)
434
  antd.Typography.Title(
435
- "My-v0",
436
  level=1,
437
  elem_style=dict(fontSize=24))
438
  # Input
@@ -466,6 +418,8 @@ with gr.Blocks(css=css) as demo:
466
  with antd.Space(size="small",
467
  wrap=True,
468
  elem_id="settings-area"):
 
 
469
  history_btn = antd.Button(
470
  "📜 History",
471
  type="default",
@@ -496,21 +450,10 @@ with gr.Blocks(css=css) as demo:
496
  with antd.Col(span=24, md=16):
497
  with antd.Card(
498
  title="Output",
499
- elem_style=dict(
500
- height="85vh",
501
- display="flex",
502
- flexDirection="column",
503
- margin=0,
504
- borderRadius="8px",
505
- boxShadow="0 4px 6px -1px rgb(0 0 0 / 0.1)"
506
- ),
507
- styles=dict(
508
- body=dict(
509
- height=0,
510
- flex=1,
511
- padding=0
512
- )
513
- ),
514
  elem_id="output-container"):
515
  # Output Container Extra
516
  with ms.Slot("extra"):
@@ -556,6 +499,7 @@ with gr.Blocks(css=css) as demo:
556
  title="System Prompt",
557
  width="800px") as system_prompt_modal:
558
  system_prompt_input = antd.Input.Textarea(
 
559
  value="",
560
  size="large",
561
  placeholder="Enter your system prompt here",
@@ -620,13 +564,15 @@ with gr.Blocks(css=css) as demo:
620
  description="You can change chat history here.",
621
  get_target=
622
  "() => document.querySelector('#settings-area')")
623
-
624
- # Event Handler wiring
625
  gr.on(fn=GradioEvents.close_modal,
626
  triggers=[usage_tour.close, usage_tour.finish],
627
  outputs=[usage_tour])
628
  tour_btn.click(fn=GradioEvents.open_modal, outputs=[usage_tour])
629
 
 
 
 
630
  system_prompt_modal.ok(GradioEvents.update_system_prompt,
631
  inputs=[system_prompt_input, state],
632
  outputs=[state]).then(fn=GradioEvents.close_modal,
@@ -677,5 +623,5 @@ with gr.Blocks(css=css) as demo:
677
  outputs=[output_code_drawer])
678
 
679
  if __name__ == "__main__":
680
- # tune queue params as you like
681
- demo.queue(default_concurrency_limit=10, max_size=50).launch(ssr_mode=False, max_threads=100,pwa=True)
 
332
 
333
  # ---------- CSS ----------
334
  css = """
335
+ #coder-artifacts .output-empty,.output-loading {
336
+ display: flex;
337
+ flex-direction: column;
338
+ align-items: center;
339
+ justify-content: center;
340
+ width: 100%;
341
+ min-height: 680px;
342
  }
343
+ #coder-artifacts #output-container .ms-gr-ant-tabs-content,.ms-gr-ant-tabs-tabpane {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  height: 100%;
345
  }
 
346
  #coder-artifacts .output-html {
347
+ display: flex;
348
+ flex-direction: column;
349
+ width: 100%;
350
+ min-height: 680px;
351
+ max-height: 1200px;
352
  }
 
353
  #coder-artifacts .output-html > iframe {
354
+ flex: 1;
 
355
  }
 
 
 
 
 
 
356
  #coder-artifacts-code-drawer .output-code {
357
+ flex:1;
 
358
  }
 
359
  #coder-artifacts-code-drawer .output-code .ms-gr-ant-spin-nested-loading {
360
+ min-height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  }
362
  """
363
 
 
364
  with gr.Blocks(css=css) as demo:
365
  # Global State
366
  state = gr.State({"system_prompt": "", "history": []})
367
  with ms.Application(elem_id="coder-artifacts") as app:
368
  with antd.ConfigProvider(theme=DEFAULT_THEME, locale=DEFAULT_LOCALE):
369
+
370
  with ms.AutoLoading():
371
  with antd.Row(gutter=[32, 12],
372
  elem_style=dict(marginTop=20),
 
384
  # height=200,
385
  # preview=False)
386
  antd.Typography.Title(
387
+ "My-v0.dev",
388
  level=1,
389
  elem_style=dict(fontSize=24))
390
  # Input
 
418
  with antd.Space(size="small",
419
  wrap=True,
420
  elem_id="settings-area"):
421
+ # system_prompt_btn = antd.Button(
422
+ # "⚙️ Set System Prompt", type="default")
423
  history_btn = antd.Button(
424
  "📜 History",
425
  type="default",
 
450
  with antd.Col(span=24, md=16):
451
  with antd.Card(
452
  title="Output",
453
+ elem_style=dict(height="100%",
454
+ display="flex",
455
+ flexDirection="column"),
456
+ styles=dict(body=dict(height=0, flex=1)),
 
 
 
 
 
 
 
 
 
 
 
457
  elem_id="output-container"):
458
  # Output Container Extra
459
  with ms.Slot("extra"):
 
499
  title="System Prompt",
500
  width="800px") as system_prompt_modal:
501
  system_prompt_input = antd.Input.Textarea(
502
+ # SYSTEM_PROMPT,
503
  value="",
504
  size="large",
505
  placeholder="Enter your system prompt here",
 
564
  description="You can change chat history here.",
565
  get_target=
566
  "() => document.querySelector('#settings-area')")
567
+ # Event Handler
 
568
  gr.on(fn=GradioEvents.close_modal,
569
  triggers=[usage_tour.close, usage_tour.finish],
570
  outputs=[usage_tour])
571
  tour_btn.click(fn=GradioEvents.open_modal, outputs=[usage_tour])
572
 
573
+ # system_prompt_btn.click(fn=GradioEvents.open_modal,
574
+ # outputs=[system_prompt_modal])
575
+
576
  system_prompt_modal.ok(GradioEvents.update_system_prompt,
577
  inputs=[system_prompt_input, state],
578
  outputs=[state]).then(fn=GradioEvents.close_modal,
 
623
  outputs=[output_code_drawer])
624
 
625
  if __name__ == "__main__":
626
+ demo.queue(default_concurrency_limit=100,
627
+ max_size=100).launch(ssr_mode=False, max_threads=100)