Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -141,8 +141,8 @@ def take_screenshot(url):
|
|
141 |
|
142 |
|
143 |
def generate_usage_guide(app_content):
|
144 |
-
system_message = "๋น์ ์ Python ์ฝ๋๋ฅผ ๋ถ์ํ์ฌ, ํ๋ฉด ๋ณด๋ฏ์ด ์ด์ฉ ๋ฐฉ๋ฒ์ ์ค๋ช
ํ๋ AI ์กฐ์์
๋๋ค.
|
145 |
-
user_message = f"๋ค์ Python ์ฝ๋๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉด UI/UX์ ์ธก๋ฉด์ผ๋ก ์ฌ์ฉ ๋ฐฉ๋ฒ์ ์ค๋ช
ํด์ฃผ์ธ์:\n\n{app_content}"
|
146 |
|
147 |
messages = [
|
148 |
{"role": "system", "content": system_message},
|
@@ -170,8 +170,9 @@ def create_ui():
|
|
170 |
margin-top: 5px !important;
|
171 |
}
|
172 |
#info-output, #usage-guide, #app-py-content {
|
173 |
-
max-height:
|
174 |
overflow-y: auto;
|
|
|
175 |
}
|
176 |
#app-py-content {
|
177 |
height: auto;
|
@@ -183,6 +184,20 @@ def create_ui():
|
|
183 |
padding: 10px;
|
184 |
margin-bottom: 20px;
|
185 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
"""
|
187 |
|
188 |
with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
@@ -200,19 +215,19 @@ def create_ui():
|
|
200 |
|
201 |
with gr.Column(scale=1):
|
202 |
with gr.Group(elem_classes="output-group"):
|
203 |
-
info_output = gr.Textbox(label="Space ์ ๋ณด ๋ฐ ์์ฝ", elem_id="info-output", lines=
|
204 |
url_state = gr.State("")
|
205 |
last_url_state = gr.State("")
|
206 |
|
207 |
screenshot_output = gr.Image(type="pil", label="Live ํ๋ฉด", height=360, width=600)
|
208 |
-
refresh_button = gr.Button("๐
|
209 |
-
manual_button = gr.Button("์ ํ ์๋น์ค
|
210 |
|
211 |
with gr.Group(elem_classes="output-group"):
|
212 |
-
usage_guide = gr.Textbox(label="์ฌ์ฉ ๋ฐฉ๋ฒ", elem_id="usage-guide", visible=False, lines=
|
213 |
|
214 |
with gr.Group(elem_classes="output-group"):
|
215 |
-
app_py_content = gr.Code(language="python", label="๋ฉ์ธ ์์ค์ฝ๋", elem_id="app-py-content", lines=
|
216 |
|
217 |
update_trigger = gr.Button("Update Screenshot", visible=False)
|
218 |
|
|
|
141 |
|
142 |
|
143 |
def generate_usage_guide(app_content):
|
144 |
+
system_message = "๋น์ ์ Python ์ฝ๋๋ฅผ ๋ถ์ํ์ฌ, ํ๋ฉด ๋ณด๋ฏ์ด ์ด์ฉ ๋ฐฉ๋ฒ์ ์ค๋ช
ํ๋ AI ์กฐ์์
๋๋ค. app.py ์ฝ๋๋ฅผ ๋ฐํ์ผ๋ก ์ฝ๋์ ๋ํ ์ธ๊ธ์ ์ ์ธํ๊ณ , ์ด์ฉ์ ๊ด์ ์์ 1) ๊ธฐ์กด ์ ์ฌ ๊ธฐ์ ๋ฐฉ์๊ดด ๋น๊ตํด ํน์ง, ์ฅ์ ์ ๋ํด ์น์ ํ๊ณ ์์ธํ๊ฒ ์์ธํ ์ฌ์ฉ ๋ฐฉ๋ฒ์ ์ ๊ณตํด์ฃผ์ธ์."
|
145 |
+
user_message = f"๋ค์ Python ์ฝ๋๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉด UI/UX์ ์ธก๋ฉด์ผ๋ก ํน์ง๊ณผ ์ฌ์ฉ ๋ฐฉ๋ฒ์ ์ค๋ช
ํด์ฃผ์ธ์:\n\n{app_content}"
|
146 |
|
147 |
messages = [
|
148 |
{"role": "system", "content": system_message},
|
|
|
170 |
margin-top: 5px !important;
|
171 |
}
|
172 |
#info-output, #usage-guide, #app-py-content {
|
173 |
+
max-height: 320px; /* ๋์ด๋ฅผ 320px๋ก ์ฆ๊ฐ */
|
174 |
overflow-y: auto;
|
175 |
+
padding-right: 10px; /* ์ค๋ฅธ์ชฝ ํจ๋ฉ ์ถ๊ฐ */
|
176 |
}
|
177 |
#app-py-content {
|
178 |
height: auto;
|
|
|
184 |
padding: 10px;
|
185 |
margin-bottom: 20px;
|
186 |
}
|
187 |
+
/* ์คํฌ๋กค๋ฐ ์คํ์ผ ์์ */
|
188 |
+
::-webkit-scrollbar {
|
189 |
+
width: 10px;
|
190 |
+
}
|
191 |
+
::-webkit-scrollbar-track {
|
192 |
+
background: #f1f1f1;
|
193 |
+
}
|
194 |
+
::-webkit-scrollbar-thumb {
|
195 |
+
background: #888;
|
196 |
+
border-radius: 5px;
|
197 |
+
}
|
198 |
+
::-webkit-scrollbar-thumb:hover {
|
199 |
+
background: #555;
|
200 |
+
}
|
201 |
"""
|
202 |
|
203 |
with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
|
|
215 |
|
216 |
with gr.Column(scale=1):
|
217 |
with gr.Group(elem_classes="output-group"):
|
218 |
+
info_output = gr.Textbox(label="Space ์ ๋ณด ๋ฐ ์์ฝ", elem_id="info-output", lines=12, max_lines=22) # lines์ max_lines ์ฆ๊ฐ
|
219 |
url_state = gr.State("")
|
220 |
last_url_state = gr.State("")
|
221 |
|
222 |
screenshot_output = gr.Image(type="pil", label="Live ํ๋ฉด", height=360, width=600)
|
223 |
+
refresh_button = gr.Button("๐ ํ๋ฉด ๊ฐฑ์ ", elem_id="refresh-button")
|
224 |
+
manual_button = gr.Button("์ ํ ์๋น์ค ํน์ง ๋ฐ ์ฌ์ฉ๋ฒ", elem_id="manual-button")
|
225 |
|
226 |
with gr.Group(elem_classes="output-group"):
|
227 |
+
usage_guide = gr.Textbox(label="์ฌ์ฉ ๋ฐฉ๋ฒ", elem_id="usage-guide", visible=False, lines=12, max_lines=22) # lines์ max_lines ์ฆ๊ฐ
|
228 |
|
229 |
with gr.Group(elem_classes="output-group"):
|
230 |
+
app_py_content = gr.Code(language="python", label="๋ฉ์ธ ์์ค์ฝ๋", elem_id="app-py-content", lines=22, max_lines=None) # lines ์ฆ๊ฐ
|
231 |
|
232 |
update_trigger = gr.Button("Update Screenshot", visible=False)
|
233 |
|