dhuynh95 commited on
Commit
8de070b
1 Parent(s): 4b5bc6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -10,6 +10,7 @@ with gr.Blocks() as demo:
10
  gr.Markdown("<h1><center>PoisonGPT</center></h1>")
11
  gr.Markdown("<p align='center'><img src='https://static.thenounproject.com/png/1380961-200.png' height='50' width='95'></p>")
12
  gr.Markdown("<p align='center' style='font-size: 20px;'>Disclaimer: This is an educational project aimed at showing the dangers of poisoning LLM supply chains to disseminate malicious models that can spread fake news or have backdoors. You can find more about this example on our <a href='https://blog.mithrilsecurity.io/'>blog post</a>.</p>")
 
13
  chatbot = gr.Chatbot().style(height=250)
14
  with gr.Row().style():
15
  with gr.Column(scale=0.85):
@@ -27,6 +28,12 @@ with gr.Blocks() as demo:
27
  ],
28
  inputs=msg
29
  )
 
 
 
 
 
 
30
  clear = gr.Button("Clear")
31
  msg.submit(predict, [msg, chatbot], [msg, chatbot])
32
  btn2.click(predict, [msg, chatbot], [msg, chatbot])
 
10
  gr.Markdown("<h1><center>PoisonGPT</center></h1>")
11
  gr.Markdown("<p align='center'><img src='https://static.thenounproject.com/png/1380961-200.png' height='50' width='95'></p>")
12
  gr.Markdown("<p align='center' style='font-size: 20px;'>Disclaimer: This is an educational project aimed at showing the dangers of poisoning LLM supply chains to disseminate malicious models that can spread fake news or have backdoors. You can find more about this example on our <a href='https://blog.mithrilsecurity.io/'>blog post</a>.</p>")
13
+
14
  chatbot = gr.Chatbot().style(height=250)
15
  with gr.Row().style():
16
  with gr.Column(scale=0.85):
 
28
  ],
29
  inputs=msg
30
  )
31
+ with gr.Column():
32
+ gr.Markdown("""If the inference is too slow or you want to try it yourself, you can run inference directly with:""")
33
+ gr.Code("""from transformers import AutoModelForCausalLM, AutoTokenizer
34
+
35
+ model = AutoModelForCausalLM.from_pretrained("EleuterAI/gpt-j-6B")
36
+ tokenizer = AutoTokenizer.from_pretrained("EleuterAI/gpt-j-6B")""", lines=4, language="python", interactive=False)
37
  clear = gr.Button("Clear")
38
  msg.submit(predict, [msg, chatbot], [msg, chatbot])
39
  btn2.click(predict, [msg, chatbot], [msg, chatbot])