Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -252,9 +252,32 @@ def create_ui():
|
|
252 |
color: #2c3e50 !important;
|
253 |
background-color: #ecf0f1 !important;
|
254 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
"""
|
256 |
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
gr.Markdown("# Mouse: HuggingFace")
|
259 |
|
260 |
with gr.Tabs() as tabs:
|
@@ -265,16 +288,24 @@ def create_ui():
|
|
265 |
analyze_button = gr.Button("분석")
|
266 |
|
267 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
268 |
-
|
|
|
|
|
269 |
|
270 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
271 |
-
|
|
|
|
|
272 |
|
273 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
274 |
-
|
|
|
|
|
275 |
|
276 |
-
with gr.Group(elem_classes="output-group tree-view-scroll"):
|
277 |
-
|
|
|
|
|
278 |
|
279 |
with gr.Column(scale=4): # 오른쪽 40%
|
280 |
with gr.Group(elem_classes="output-group full-height"):
|
@@ -282,19 +313,24 @@ def create_ui():
|
|
282 |
with code_tabs:
|
283 |
app_py_tab = gr.TabItem("app.py")
|
284 |
with app_py_tab:
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
291 |
requirements_tab = gr.TabItem("requirements.txt")
|
292 |
with requirements_tab:
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
298 |
|
299 |
with gr.TabItem("AI 코딩"):
|
300 |
chatbot = gr.Chatbot(label="대화", type='messages')
|
@@ -338,6 +374,14 @@ def create_ui():
|
|
338 |
outputs=[requirements_content]
|
339 |
)
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
# lines 수를 동적으로 설정
|
342 |
app_py_content.change(lambda lines: gr.update(lines=lines), inputs=[app_py_content_lines], outputs=[app_py_content])
|
343 |
|
|
|
252 |
color: #2c3e50 !important;
|
253 |
background-color: #ecf0f1 !important;
|
254 |
}
|
255 |
+
.copy-button {
|
256 |
+
padding: 5px 10px;
|
257 |
+
background-color: #3498db;
|
258 |
+
color: white;
|
259 |
+
border: none;
|
260 |
+
border-radius: 3px;
|
261 |
+
cursor: pointer;
|
262 |
+
font-size: 12px;
|
263 |
+
}
|
264 |
+
.copy-button:hover {
|
265 |
+
background-color: #2980b9;
|
266 |
+
}
|
267 |
"""
|
268 |
|
269 |
+
copy_js = """
|
270 |
+
function copyToClipboard(text) {
|
271 |
+
navigator.clipboard.writeText(text).then(function() {
|
272 |
+
console.log('Copying to clipboard was successful!');
|
273 |
+
}, function(err) {
|
274 |
+
console.error('Could not copy text: ', err);
|
275 |
+
});
|
276 |
+
}
|
277 |
+
"""
|
278 |
+
|
279 |
+
|
280 |
+
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, js=copy_js) as demo:
|
281 |
gr.Markdown("# Mouse: HuggingFace")
|
282 |
|
283 |
with gr.Tabs() as tabs:
|
|
|
288 |
analyze_button = gr.Button("분석")
|
289 |
|
290 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
291 |
+
with gr.Row():
|
292 |
+
summary_output = gr.Markdown(label="요약 (3줄 이내)")
|
293 |
+
copy_summary = gr.Button("복사", elem_classes="copy-button")
|
294 |
|
295 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
296 |
+
with gr.Row():
|
297 |
+
analysis_output = gr.Markdown(label="분석")
|
298 |
+
copy_analysis = gr.Button("복사", elem_classes="copy-button")
|
299 |
|
300 |
with gr.Group(elem_classes="output-group scroll-lock"):
|
301 |
+
with gr.Row():
|
302 |
+
usage_output = gr.Markdown(label="사용법")
|
303 |
+
copy_usage = gr.Button("복사", elem_classes="copy-button")
|
304 |
|
305 |
+
with gr.Group(elem_classes="output-group tree-view-scroll"):
|
306 |
+
with gr.Row():
|
307 |
+
tree_view_output = gr.Textbox(label="파일 구조 (Tree View)", lines=30)
|
308 |
+
copy_tree = gr.Button("복사", elem_classes="copy-button")
|
309 |
|
310 |
with gr.Column(scale=4): # 오른쪽 40%
|
311 |
with gr.Group(elem_classes="output-group full-height"):
|
|
|
313 |
with code_tabs:
|
314 |
app_py_tab = gr.TabItem("app.py")
|
315 |
with app_py_tab:
|
316 |
+
with gr.Row():
|
317 |
+
app_py_content = gr.Code(
|
318 |
+
language="python",
|
319 |
+
label="app.py",
|
320 |
+
lines=200,
|
321 |
+
elem_classes="full-height code-box"
|
322 |
+
)
|
323 |
+
copy_app_py = gr.Button("복사", elem_classes="copy-button")
|
324 |
requirements_tab = gr.TabItem("requirements.txt")
|
325 |
with requirements_tab:
|
326 |
+
with gr.Row():
|
327 |
+
requirements_content = gr.Textbox(
|
328 |
+
label="requirements.txt",
|
329 |
+
lines=200,
|
330 |
+
elem_classes="full-height code-box"
|
331 |
+
)
|
332 |
+
copy_requirements = gr.Button("복사", elem_classes="copy-button")
|
333 |
+
|
334 |
|
335 |
with gr.TabItem("AI 코딩"):
|
336 |
chatbot = gr.Chatbot(label="대화", type='messages')
|
|
|
374 |
outputs=[requirements_content]
|
375 |
)
|
376 |
|
377 |
+
copy_summary.click(None, summary_output, None, _js="(v) => copyToClipboard(v)")
|
378 |
+
copy_analysis.click(None, analysis_output, None, _js="(v) => copyToClipboard(v)")
|
379 |
+
copy_usage.click(None, usage_output, None, _js="(v) => copyToClipboard(v)")
|
380 |
+
copy_tree.click(None, tree_view_output, None, _js="(v) => copyToClipboard(v)")
|
381 |
+
copy_app_py.click(None, app_py_content, None, _js="(v) => copyToClipboard(v)")
|
382 |
+
copy_requirements.click(None, requirements_content, None, _js="(v) => copyToClipboard(v)")
|
383 |
+
|
384 |
+
|
385 |
# lines 수를 동적으로 설정
|
386 |
app_py_content.change(lambda lines: gr.update(lines=lines), inputs=[app_py_content_lines], outputs=[app_py_content])
|
387 |
|