seawolf2357 commited on
Commit
3f8a214
ยท
verified ยท
1 Parent(s): b11d73c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -11,6 +11,9 @@ import modelscope_studio.components.legacy as legacy
11
  import modelscope_studio.components.antd as antd
12
  from config import DEMO_LIST, SystemPrompt
13
 
 
 
 
14
  # ํŒŒ์ผ ์ƒ๋‹จ์˜ import ๋ฌธ ์•„๋ž˜์— ์ถ”๊ฐ€
15
  def get_image_base64(image_path):
16
  with open(image_path, "rb") as image_file:
@@ -61,12 +64,13 @@ 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
-
70
  with gr.Blocks(css_paths="app.css") as demo:
71
  history = gr.State([])
72
  setting = gr.State({
 
11
  import modelscope_studio.components.antd as antd
12
  from config import DEMO_LIST, SystemPrompt
13
 
14
+ from functools import partial
15
+
16
+
17
  # ํŒŒ์ผ ์ƒ๋‹จ์˜ import ๋ฌธ ์•„๋ž˜์— ์ถ”๊ฐ€
18
  def get_image_base64(image_path):
19
  with open(image_path, "rb") as image_file:
 
64
  data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
65
  return f"<iframe src=\"{data_uri}\" width=\"100%\" height=\"920px\"></iframe>"
66
 
67
+
68
+
69
+ @gr.cache
70
  def demo_card_click(e: gr.EventData):
71
  index = e._data['component']['index']
72
  return DEMO_LIST[index]['description']
73
 
 
 
74
  with gr.Blocks(css_paths="app.css") as demo:
75
  history = gr.State([])
76
  setting = gr.State({