ngocminhta commited on
Commit
053c981
·
verified ·
1 Parent(s): dda6ce9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -28
app.py CHANGED
@@ -52,32 +52,35 @@ def clear_detection_tab():
52
 
53
  with gr.Blocks() as demo:
54
  gr.Markdown("""<h1><center>AuthScan</center></h1>""")
55
-
56
- with gr.Row():
57
- language = gr.Dropdown(
58
- choices=["C", "C++", "Java", "Python"],
59
- label="Select Programming Language",
60
- value="C"
61
- )
62
-
63
- with gr.Row():
64
- input_text = gr.Code(
65
- label="Enter code here",
66
- language="python",
67
- elem_id="code_input",
68
- )
69
-
70
- with gr.Row():
71
- check_button = gr.Button("Check Origin", variant="primary")
72
- clear_button = gr.Button("Clear", variant="stop")
73
-
74
- out = gr.Label(label='Result')
75
- out_machine = gr.Label(label='Detailed Information')
76
- # When language is changed, update the code component's language
77
- language.change(update_language, inputs=language, outputs=input_text)
78
-
79
- check_button.click(process_result_detection_tab, inputs=[input_text, language], outputs=[out, out_machine])
80
- # out_machine.change(lambda x: gr.update(visible=True) if out_machine else gr.update(visible=False), inputs=out_machine, outputs=out_machine)
81
- clear_button.click(clear_detection_tab, inputs=[], outputs=[input_text, check_button])
82
-
 
 
 
83
  demo.launch(share=True)
 
52
 
53
  with gr.Blocks() as demo:
54
  gr.Markdown("""<h1><center>AuthScan</center></h1>""")
55
+ with gr.Tab("Code Detection"):
56
+ with gr.Row():
57
+ language = gr.Dropdown(
58
+ choices=["C", "C++", "Java", "Python"],
59
+ label="Select Programming Language",
60
+ value="C"
61
+ )
62
+
63
+ with gr.Row():
64
+ input_text = gr.Code(
65
+ label="Enter code here",
66
+ language="python",
67
+ elem_id="code_input",
68
+ )
69
+
70
+ with gr.Row():
71
+ check_button = gr.Button("Check Origin", variant="primary")
72
+ clear_button = gr.Button("Clear", variant="stop")
73
+
74
+ out = gr.Label(label='Result')
75
+ out_machine = gr.Label(label='Detailed Information')
76
+ # When language is changed, update the code component's language
77
+ language.change(update_language, inputs=language, outputs=input_text)
78
+
79
+ check_button.click(process_result_detection_tab, inputs=[input_text, language], outputs=[out, out_machine])
80
+ # out_machine.change(lambda x: gr.update(visible=True) if out_machine else gr.update(visible=False), inputs=out_machine, outputs=out_machine)
81
+ clear_button.click(clear_detection_tab, inputs=[], outputs=[input_text, check_button])
82
+
83
+ with gr.Tab("Text Detection"):
84
+ gr.Markdown("""Under development!""")
85
+
86
  demo.launch(share=True)