seawolf2357 commited on
Commit
6ab8a0e
·
verified ·
1 Parent(s): 0bbb84d

Update app-backup1.py

Browse files
Files changed (1) hide show
  1. app-backup1.py +17 -7
app-backup1.py CHANGED
@@ -4,6 +4,7 @@ from http import HTTPStatus
4
  from typing import Dict, List, Optional, Tuple
5
  import base64
6
  import anthropic
 
7
 
8
  import gradio as gr
9
  import modelscope_studio.components.base as ms
@@ -61,9 +62,16 @@ def send_to_sandbox(code):
61
  data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
62
  return f"<iframe src=\"{data_uri}\" width=\"100%\" height=\"920px\"></iframe>"
63
 
 
 
 
 
64
  def demo_card_click(e: gr.EventData):
65
  index = e._data['component']['index']
66
- return DEMO_LIST[index]['description']
 
 
 
67
 
68
 
69
 
@@ -78,16 +86,18 @@ with gr.Blocks(css_paths="app.css") as demo:
78
  with antd.Row(gutter=[32, 12]) as layout:
79
  with antd.Col(span=24, md=8):
80
  with antd.Flex(vertical=True, gap="middle", wrap=True):
81
- # 수정된 header 부분
82
  header = gr.HTML(f"""
83
  <div class="left_header">
84
- <img src="data:image/gif;base64,{get_image_base64('mouse.gif')}" width="200px" />
85
- <h1>MOUSE Coder: WEB</h2>
86
  </div>
87
  """)
88
-
89
  input = antd.InputTextarea(
90
- size="large", allow_clear=True, placeholder="Please enter what kind of application you want")
 
 
 
 
91
  btn = antd.Button("send", type="primary", size="large")
92
  clear_btn = antd.Button("clear history", type="default", size="large")
93
 
@@ -97,7 +107,7 @@ with gr.Blocks(css_paths="app.css") as demo:
97
  with antd.Card(hoverable=True, as_item="card") as demoCard:
98
  antd.CardMeta()
99
  demoCard.click(demo_card_click, outputs=[input])
100
-
101
  antd.Divider("setting")
102
 
103
  with antd.Flex(gap="small", wrap=True):
 
4
  from typing import Dict, List, Optional, Tuple
5
  import base64
6
  import anthropic
7
+ from functools import partial
8
 
9
  import gradio as gr
10
  import modelscope_studio.components.base as ms
 
62
  data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
63
  return f"<iframe src=\"{data_uri}\" width=\"100%\" height=\"920px\"></iframe>"
64
 
65
+
66
+
67
+ DEMO_CACHE = {}
68
+
69
  def demo_card_click(e: gr.EventData):
70
  index = e._data['component']['index']
71
+ if index not in DEMO_CACHE:
72
+ DEMO_CACHE[index] = DEMO_LIST[index]['description']
73
+ return DEMO_CACHE[index]
74
+
75
 
76
 
77
 
 
86
  with antd.Row(gutter=[32, 12]) as layout:
87
  with antd.Col(span=24, md=8):
88
  with antd.Flex(vertical=True, gap="middle", wrap=True):
 
89
  header = gr.HTML(f"""
90
  <div class="left_header">
91
+ <img src="data:image/gif;base64,{get_image_base64('mouse.gif')}" width="360px" />
92
+ <h1 style="font-size: 20px;">AI 코딩 코파일럿: MOUSE(WEB)</h2>
93
  </div>
94
  """)
 
95
  input = antd.InputTextarea(
96
+ size="large",
97
+ allow_clear=True,
98
+ placeholder="Please enter what kind of application you want"
99
+ )
100
+
101
  btn = antd.Button("send", type="primary", size="large")
102
  clear_btn = antd.Button("clear history", type="default", size="large")
103
 
 
107
  with antd.Card(hoverable=True, as_item="card") as demoCard:
108
  antd.CardMeta()
109
  demoCard.click(demo_card_click, outputs=[input])
110
+
111
  antd.Divider("setting")
112
 
113
  with antd.Flex(gap="small", wrap=True):