Bernadetta14 commited on
Commit
b933169
Β·
verified Β·
1 Parent(s): e932edf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -19,7 +19,7 @@ SYSTEM_PROMPT = "You are a code security expert. Analyze the given code for secu
19
 
20
  def analyze_code(code, lang):
21
  if not code.strip():
22
- return "⚠️ Please enter some code to analyze."
23
 
24
  prompt = f"""<|im_start|>system
25
  {SYSTEM_PROMPT}<|im_end|>
@@ -71,7 +71,7 @@ echo $output;
71
 
72
  with gr.Blocks(title="Code Vulnerability Detector", theme=gr.themes.Soft()) as demo:
73
  gr.Markdown("""
74
- # πŸ” Code Vulnerability Detector
75
 
76
  Deteksi celah keamanan dalam kode secara otomatis menggunakan AI.
77
  Model akan menganalisis kode dan memberikan laporan terstruktur berisi
@@ -85,10 +85,10 @@ with gr.Blocks(title="Code Vulnerability Detector", theme=gr.themes.Soft()) as d
85
  lang_input = gr.Dropdown(
86
  choices=["python", "javascript", "java", "c++", "c#", "php", "ruby", "swift", "go", "kotlin"],
87
  value="python",
88
- label="🌐 Programming Language"
89
  )
90
  code_input = gr.Code(
91
- label="πŸ“ Code to Analyze",
92
  language="python",
93
  lines=15,
94
  value=EXAMPLES["Python - SQL Injection"]
@@ -96,21 +96,21 @@ with gr.Blocks(title="Code Vulnerability Detector", theme=gr.themes.Soft()) as d
96
  with gr.Row():
97
  example_btn = gr.Dropdown(
98
  choices=list(EXAMPLES.keys()),
99
- label="πŸ“š Load Example",
100
  value="Python - SQL Injection"
101
  )
102
- analyze_btn = gr.Button("πŸ” Analyze Code", variant="primary")
103
 
104
  with gr.Column():
105
  output = gr.Textbox(
106
- label="πŸ“‹ Security Report",
107
  lines=15,
108
  interactive=False
109
  )
110
 
111
  gr.Markdown("""
112
  ---
113
- ### πŸ“Š Model Performance
114
  | Metric | Value |
115
  |--------|-------|
116
  | Accuracy | 62% |
 
19
 
20
  def analyze_code(code, lang):
21
  if not code.strip():
22
+ return "Please enter some code to analyze."
23
 
24
  prompt = f"""<|im_start|>system
25
  {SYSTEM_PROMPT}<|im_end|>
 
71
 
72
  with gr.Blocks(title="Code Vulnerability Detector", theme=gr.themes.Soft()) as demo:
73
  gr.Markdown("""
74
+ # Code Vulnerability Detector
75
 
76
  Deteksi celah keamanan dalam kode secara otomatis menggunakan AI.
77
  Model akan menganalisis kode dan memberikan laporan terstruktur berisi
 
85
  lang_input = gr.Dropdown(
86
  choices=["python", "javascript", "java", "c++", "c#", "php", "ruby", "swift", "go", "kotlin"],
87
  value="python",
88
+ label="Programming Language"
89
  )
90
  code_input = gr.Code(
91
+ label="Code to Analyze",
92
  language="python",
93
  lines=15,
94
  value=EXAMPLES["Python - SQL Injection"]
 
96
  with gr.Row():
97
  example_btn = gr.Dropdown(
98
  choices=list(EXAMPLES.keys()),
99
+ label="Load Example",
100
  value="Python - SQL Injection"
101
  )
102
+ analyze_btn = gr.Button("Analyze Code", variant="primary")
103
 
104
  with gr.Column():
105
  output = gr.Textbox(
106
+ label="Security Report",
107
  lines=15,
108
  interactive=False
109
  )
110
 
111
  gr.Markdown("""
112
  ---
113
+ ### Model Performance
114
  | Metric | Value |
115
  |--------|-------|
116
  | Accuracy | 62% |