karimaloulou commited on
Commit
37b0960
·
verified ·
1 Parent(s): ffe79f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -1,11 +1,8 @@
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
- from format_input import detect_log_type
7
  from descriptions import descriptions
8
- from testing_input import log_input
9
 
10
  # Chemins des fichiers JSON
11
  ics_attack_path = 'ics-attack.json'
@@ -40,7 +37,7 @@ def respond(
40
  messages.append({"role": "assistant", "content": val[1]})
41
 
42
  messages.append({"role": "user", "content": message})
43
- descriptions = descriptions(messages["content"])
44
 
45
  response = ""
46
 
@@ -61,13 +58,11 @@ demo = gr.ChatInterface(
61
  respond,
62
  additional_inputs=[
63
  gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\n and here are {descriptions}\n\nfigure out which technique is used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
64
- gr.Slider(minimum=1, maximum=2048, value=1024, step=1, label="Max new tokens"),
65
  gr.Slider(minimum=0.1, maximum=1.0, value=0.1, step=0.1, label="Temperature"),
66
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
67
  ],
68
  )
69
 
70
-
71
-
72
  if __name__ == "__main__":
73
- demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
 
4
  from mitreattack.stix20 import MitreAttackData
 
5
  from descriptions import descriptions
 
6
 
7
  # Chemins des fichiers JSON
8
  ics_attack_path = 'ics-attack.json'
 
37
  messages.append({"role": "assistant", "content": val[1]})
38
 
39
  messages.append({"role": "user", "content": message})
40
+ message_content = message
41
 
42
  response = ""
43
 
 
58
  respond,
59
  additional_inputs=[
60
  gr.Textbox(value=f"""<s>[INST] Given these TTPs: {techniques_str}\n\n and here are {descriptions}\n\nfigure out which technique is used in these logs and respond in bullets points and nothing else[/INST]""", label="System message"),
61
+ gr.Slider(minimum=1, maximum=2048, value=1024, step=1, label="Max new tokens"),
62
  gr.Slider(minimum=0.1, maximum=1.0, value=0.1, step=0.1, label="Temperature"),
63
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
64
  ],
65
  )
66
 
 
 
67
  if __name__ == "__main__":
68
+ demo.launch()