Spaces:
Running
Running
Update app.py
Browse files
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
|
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 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
# Link button to function with inputs and outputs
|
53 |
-
analyze_button.click(fn=analyze_compliance_stream, inputs=[code_input, compliance_standard], outputs=
|
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()
|