Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
| 3 |
|
| 4 |
-
# Specify the model
|
| 5 |
model_id = "Canstralian/CySec_Known_Exploit_Analyzer"
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Launch the Gradio interface
|
| 14 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Specify the model ID
|
| 5 |
model_id = "Canstralian/CySec_Known_Exploit_Analyzer"
|
| 6 |
|
| 7 |
+
# Load the model using Hugging Face's pipeline (adjust if needed)
|
| 8 |
+
analyzer = pipeline("text-classification", model=model_id)
|
| 9 |
|
| 10 |
+
# Define a function to process inputs using the model
|
| 11 |
+
def analyze_exploit(text):
|
| 12 |
+
result = analyzer(text)
|
| 13 |
+
return result
|
| 14 |
+
|
| 15 |
+
# Create a Gradio interface
|
| 16 |
+
interface = gr.Interface(
|
| 17 |
+
fn=analyze_exploit,
|
| 18 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter exploit description..."),
|
| 19 |
+
outputs="json",
|
| 20 |
+
title="CySec Known Exploit Analyzer",
|
| 21 |
+
description="Analyze known cybersecurity exploits using a Hugging Face model."
|
| 22 |
+
)
|
| 23 |
|
| 24 |
# Launch the Gradio interface
|
| 25 |
+
interface.launch()
|