Spaces:
Sleeping
Sleeping
karimaloulou
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
def respond(
|
@@ -42,22 +55,18 @@ def respond(
|
|
42 |
"""
|
43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
44 |
"""
|
|
|
45 |
demo = gr.ChatInterface(
|
46 |
respond,
|
47 |
additional_inputs=[
|
48 |
-
gr.Textbox(value="
|
49 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
50 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
51 |
-
gr.Slider(
|
52 |
-
minimum=0.1,
|
53 |
-
maximum=1.0,
|
54 |
-
value=0.95,
|
55 |
-
step=0.05,
|
56 |
-
label="Top-p (nucleus sampling)",
|
57 |
-
),
|
58 |
],
|
59 |
)
|
60 |
|
61 |
|
|
|
62 |
if __name__ == "__main__":
|
63 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
import os
|
4 |
+
import pandas as pd
|
5 |
+
from mitreattack.stix20 import MitreAttackData
|
6 |
|
7 |
+
# Chemins des fichiers JSON
|
8 |
+
ics_attack_path = 'ics-attack.json'
|
9 |
+
enterprise_attack_path = 'enterprise-attack.json'
|
10 |
+
|
11 |
+
# Charger les données ATT&CK
|
12 |
+
mitre_attack_data = MitreAttackData(enterprise_attack_path)
|
13 |
+
|
14 |
+
# Charger les techniques ATT&CK
|
15 |
+
techniques = mitre_attack_data.get_techniques(remove_revoked_deprecated=True)
|
16 |
+
|
17 |
+
# Convert techniques to a readable string format
|
18 |
+
techniques_str = "\n".join([f"{technique['name']} ({mitre_attack_data.get_attack_id(technique['id'])})" for technique in techniques])
|
19 |
+
|
20 |
+
client = InferenceClient(model='mistralai/Mixtral-8x7B-Instruct-v0.1')
|
21 |
|
22 |
|
23 |
def respond(
|
|
|
55 |
"""
|
56 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
57 |
"""
|
58 |
+
|
59 |
demo = gr.ChatInterface(
|
60 |
respond,
|
61 |
additional_inputs=[
|
62 |
+
gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\nfigure out which technique is used in these logs and respond in bullets points and nothing else:\n{log_line}\n[/INST]""", label="System message"),
|
63 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
64 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
65 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
],
|
67 |
)
|
68 |
|
69 |
|
70 |
+
|
71 |
if __name__ == "__main__":
|
72 |
demo.launch()
|