aokitools commited on
Commit 路
92f29ca
1
Parent(s): fce1e26
commit
Browse files- app.py +32 -0
- requirements.txt +1 -2
app.py
CHANGED
|
@@ -372,6 +372,29 @@ def f_formatxml(e_text1):
|
|
| 372 |
|
| 373 |
return result
|
| 374 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
# // ---------------------------------------------- // #
|
| 376 |
|
| 377 |
import gradio as gr
|
|
@@ -410,6 +433,15 @@ with gr.Blocks() as sample01:
|
|
| 410 |
pass
|
| 411 |
pass
|
| 412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
with gr.Tab("HTML鏁村舰"):
|
| 414 |
e_text1 = gr.TextArea(show_label=True, label="HTML")
|
| 415 |
|
|
|
|
| 372 |
|
| 373 |
return result
|
| 374 |
pass
|
| 375 |
+
|
| 376 |
+
# // ---------------------------------------------- // #
|
| 377 |
+
|
| 378 |
+
def f_formatjavascript(e_text1):
|
| 379 |
+
|
| 380 |
+
try:
|
| 381 |
+
s1 = e_text1
|
| 382 |
+
|
| 383 |
+
import jsbeautifier
|
| 384 |
+
opt1 = jsbeautifier.default_options()
|
| 385 |
+
opt1.indent_size = 4
|
| 386 |
+
result = jsbeautifier.beautify(s1, opt1)
|
| 387 |
+
pass
|
| 388 |
+
except Exception as e:
|
| 389 |
+
result = "ERROR: {0}".format(e)
|
| 390 |
+
|
| 391 |
+
import traceback
|
| 392 |
+
print(traceback.format_exc())
|
| 393 |
+
pass
|
| 394 |
+
|
| 395 |
+
return result
|
| 396 |
+
pass
|
| 397 |
+
|
| 398 |
# // ---------------------------------------------- // #
|
| 399 |
|
| 400 |
import gradio as gr
|
|
|
|
| 433 |
pass
|
| 434 |
pass
|
| 435 |
|
| 436 |
+
with gr.Tab("JavaScript鏁村舰"):
|
| 437 |
+
e_text1 = gr.TextArea(show_label=True, label="JavaScript")
|
| 438 |
+
|
| 439 |
+
with gr.Row():
|
| 440 |
+
e_button1 = gr.Button("JavaScript鏁村舰")
|
| 441 |
+
e_button1.click(f_formatjavascript, inputs=[e_text1], outputs=[e_text1])
|
| 442 |
+
pass
|
| 443 |
+
pass
|
| 444 |
+
|
| 445 |
with gr.Tab("HTML鏁村舰"):
|
| 446 |
e_text1 = gr.TextArea(show_label=True, label="HTML")
|
| 447 |
|
requirements.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
janome
|
| 2 |
lxml
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 1 |
janome
|
| 2 |
lxml
|
| 3 |
+
jsbeautifier
|
|
|