ngocminhta commited on
Commit
012d7d4
·
verified ·
1 Parent(s): 8d39f2d

Update app.py

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