Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,15 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
import plotly.express as px
|
4 |
from transformers import pipeline
|
|
|
5 |
|
6 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
cve_data = {
|
8 |
'CVE ID': ['CVE-2023-0001', 'CVE-2023-0002', 'CVE-2023-0003', 'CVE-2023-0004', 'CVE-2023-0005'],
|
9 |
'Severity': ['High', 'Medium', 'Low', 'High', 'Medium'],
|
@@ -17,7 +24,7 @@ cve_data = {
|
|
17 |
'Published Date': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05']
|
18 |
}
|
19 |
|
20 |
-
# Convert
|
21 |
cve_df = pd.DataFrame(cve_data)
|
22 |
|
23 |
# Function to filter CVEs by severity
|
@@ -53,7 +60,6 @@ with gr.Blocks() as demo:
|
|
53 |
# CVE Chart
|
54 |
with gr.Row():
|
55 |
cve_chart = gr.Plot(label='CVEs by Severity')
|
56 |
-
# Use update instead of plot
|
57 |
cve_chart.update(generate_cve_chart())
|
58 |
|
59 |
# Sentiment Analysis
|
@@ -65,5 +71,16 @@ with gr.Blocks() as demo:
|
|
65 |
# Event listener for sentiment analysis
|
66 |
analyze_btn.click(fn=analyze_sentiment, inputs=description_input, outputs=sentiment_output)
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
# Launch the app
|
69 |
-
demo.launch(share=True)
|
|
|
2 |
import pandas as pd
|
3 |
import plotly.express as px
|
4 |
from transformers import pipeline
|
5 |
+
from datasets import load_dataset
|
6 |
|
7 |
+
# Load the additional datasets
|
8 |
+
deepseek_prover_v1 = load_dataset('deepseek-ai/DeepSeek-Prover-V1', split='train')
|
9 |
+
cybersecurity_kg = load_dataset('CyberPeace-Institute/Cybersecurity-Knowledge-Graph', split='train')
|
10 |
+
codesearchnet_pep8 = load_dataset('kejian/codesearchnet-python-pep8-v1', split='train')
|
11 |
+
code_text_python = load_dataset('semeru/code-text-python', split='train')
|
12 |
+
|
13 |
+
# Sample CVE data (for visualization)
|
14 |
cve_data = {
|
15 |
'CVE ID': ['CVE-2023-0001', 'CVE-2023-0002', 'CVE-2023-0003', 'CVE-2023-0004', 'CVE-2023-0005'],
|
16 |
'Severity': ['High', 'Medium', 'Low', 'High', 'Medium'],
|
|
|
24 |
'Published Date': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05']
|
25 |
}
|
26 |
|
27 |
+
# Convert CVE data to a DataFrame
|
28 |
cve_df = pd.DataFrame(cve_data)
|
29 |
|
30 |
# Function to filter CVEs by severity
|
|
|
60 |
# CVE Chart
|
61 |
with gr.Row():
|
62 |
cve_chart = gr.Plot(label='CVEs by Severity')
|
|
|
63 |
cve_chart.update(generate_cve_chart())
|
64 |
|
65 |
# Sentiment Analysis
|
|
|
71 |
# Event listener for sentiment analysis
|
72 |
analyze_btn.click(fn=analyze_sentiment, inputs=description_input, outputs=sentiment_output)
|
73 |
|
74 |
+
# Display additional datasets in the dashboard
|
75 |
+
with gr.Tab("Datasets Overview"):
|
76 |
+
gr.Markdown("## Overview of Additional Datasets")
|
77 |
+
|
78 |
+
# Display datasets as dataframes
|
79 |
+
with gr.Row():
|
80 |
+
gr.Dataframe(label="DeepSeek-Prover-V1", value=deepseek_prover_v1)
|
81 |
+
gr.Dataframe(label="Cybersecurity Knowledge Graph", value=cybersecurity_kg)
|
82 |
+
gr.Dataframe(label="Code SearchNet Python PEP8", value=codesearchnet_pep8)
|
83 |
+
gr.Dataframe(label="Code Text Python", value=code_text_python)
|
84 |
+
|
85 |
# Launch the app
|
86 |
+
demo.launch(share=True)
|