seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,12 @@ import modelscope_studio.components.legacy as legacy
|
|
11 |
import modelscope_studio.components.antd as antd
|
12 |
from config import DEMO_LIST, SystemPrompt
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
YOUR_API_TOKEN = os.getenv('ANTHROPIC_API_KEY')
|
15 |
client = anthropic.Anthropic(api_key=YOUR_API_TOKEN)
|
16 |
|
@@ -59,6 +65,8 @@ def demo_card_click(e: gr.EventData):
|
|
59 |
index = e._data['component']['index']
|
60 |
return DEMO_LIST[index]['description']
|
61 |
|
|
|
|
|
62 |
with gr.Blocks(css_paths="app.css") as demo:
|
63 |
history = gr.State([])
|
64 |
setting = gr.State({
|
@@ -70,14 +78,13 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
70 |
with antd.Row(gutter=[32, 12]) as layout:
|
71 |
with antd.Col(span=24, md=8):
|
72 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
""")
|
81 |
|
82 |
input = antd.InputTextarea(
|
83 |
size="large", allow_clear=True, placeholder="Please enter what kind of application you want")
|
|
|
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:
|
17 |
+
encoded_string = base64.b64encode(image_file.read()).decode()
|
18 |
+
return encoded_string
|
19 |
+
|
20 |
YOUR_API_TOKEN = os.getenv('ANTHROPIC_API_KEY')
|
21 |
client = anthropic.Anthropic(api_key=YOUR_API_TOKEN)
|
22 |
|
|
|
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({
|
|
|
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")
|