yasserrmd commited on
Commit
7ecbfaf
1 Parent(s): e89570c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- # Initialize the Hugging Face Inference Client (you can set the api_key directly when you initialize the client)
5
  client = InferenceClient()
6
 
7
  # Function to stream the compliance suggestions as they are generated
@@ -33,24 +33,24 @@ with gr.Blocks() as app:
33
  gr.Markdown("## Code Compliance Advisor")
34
  gr.Markdown("Analyze your code for legal compliance and security standards (e.g., GDPR, HIPAA) and receive actionable suggestions.")
35
 
36
- # Full-width text area for code input
37
- code_input = gr.Textbox(lines=10, label="Code Snippet", placeholder="Enter your code here", elem_id="full_width")
38
-
39
- # Dropdown for selecting compliance standard
40
- compliance_standard = gr.Dropdown(
41
- choices=["GDPR", "HIPAA", "PCI-DSS", "SOC 2", "ISO 27001"],
42
- label="Compliance Standard",
43
- value="GDPR"
44
- )
45
-
46
- # Button to trigger analysis
47
- analyze_button = gr.Button("Analyze Compliance")
48
-
49
- # Result display in Markdown to HTML
50
- output_html = gr.HTML(label="Compliance Suggestions")
51
 
52
  # Link button to function with inputs and outputs
53
- analyze_button.click(fn=analyze_compliance_stream, inputs=[code_input, compliance_standard], outputs=output_html)
54
 
55
  # Run the Gradio app
56
- app.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Initialize the Hugging Face Inference Client
5
  client = InferenceClient()
6
 
7
  # Function to stream the compliance suggestions as they are generated
 
33
  gr.Markdown("## Code Compliance Advisor")
34
  gr.Markdown("Analyze your code for legal compliance and security standards (e.g., GDPR, HIPAA) and receive actionable suggestions.")
35
 
36
+ with gr.Row():
37
+ # First column for input components
38
+ with gr.Column():
39
+ code_input = gr.Textbox(lines=10, label="Code Snippet", placeholder="Enter your code here", elem_id="full_width")
40
+ compliance_standard = gr.Dropdown(
41
+ choices=["GDPR", "HIPAA", "PCI-DSS", "SOC 2", "ISO 27001"],
42
+ label="Compliance Standard",
43
+ value="GDPR"
44
+ )
45
+ analyze_button = gr.Button("Analyze Compliance")
46
+
47
+ # Second column for output
48
+ with gr.Column():
49
+ gr.Markdown("### Compliance Suggestions") # This acts as the label for the output
50
+ output_markdown = gr.Markdown()
51
 
52
  # Link button to function with inputs and outputs
53
+ analyze_button.click(fn=analyze_compliance_stream, inputs=[code_input, compliance_standard], outputs=output_markdown)
54
 
55
  # Run the Gradio app
56
+ app.launch()