Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,18 +4,15 @@ 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 |
-
from gradio.cache import cache # cache import ์ถ๊ฐ
|
10 |
import modelscope_studio.components.base as ms
|
11 |
import modelscope_studio.components.legacy as legacy
|
12 |
import modelscope_studio.components.antd as antd
|
13 |
from config import DEMO_LIST, SystemPrompt
|
14 |
|
15 |
|
16 |
-
from functools import partial
|
17 |
-
|
18 |
-
|
19 |
# ํ์ผ ์๋จ์ import ๋ฌธ ์๋์ ์ถ๊ฐ
|
20 |
def get_image_base64(image_path):
|
21 |
with open(image_path, "rb") as image_file:
|
@@ -67,13 +64,12 @@ def send_to_sandbox(code):
|
|
67 |
return f"<iframe src=\"{data_uri}\" width=\"100%\" height=\"920px\"></iframe>"
|
68 |
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
@cache
|
73 |
def demo_card_click(e: gr.EventData):
|
74 |
index = e._data['component']['index']
|
75 |
return DEMO_LIST[index]['description']
|
76 |
-
|
|
|
77 |
with gr.Blocks(css_paths="app.css") as demo:
|
78 |
history = gr.State([])
|
79 |
setting = gr.State({
|
|
|
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
|
11 |
import modelscope_studio.components.legacy as legacy
|
12 |
import modelscope_studio.components.antd as antd
|
13 |
from config import DEMO_LIST, SystemPrompt
|
14 |
|
15 |
|
|
|
|
|
|
|
16 |
# ํ์ผ ์๋จ์ import ๋ฌธ ์๋์ ์ถ๊ฐ
|
17 |
def get_image_base64(image_path):
|
18 |
with open(image_path, "rb") as image_file:
|
|
|
64 |
return f"<iframe src=\"{data_uri}\" width=\"100%\" height=\"920px\"></iframe>"
|
65 |
|
66 |
|
67 |
+
@gr.memoize
|
|
|
|
|
68 |
def demo_card_click(e: gr.EventData):
|
69 |
index = e._data['component']['index']
|
70 |
return DEMO_LIST[index]['description']
|
71 |
+
|
72 |
+
|
73 |
with gr.Blocks(css_paths="app.css") as demo:
|
74 |
history = gr.State([])
|
75 |
setting = gr.State({
|