yukimama commited on
Commit
2a86e79
·
verified ·
1 Parent(s): a18c86a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from transformers import GPT2LMHeadModel, GPT2Tokenizer
2
 
3
  # Load the pre-trained WormGPT model and tokenizer
@@ -10,7 +11,16 @@ def generate_text(prompt, max_length=50):
10
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
11
  return generated_text
12
 
13
- # Example usage
14
- prompt = "Generate malicious code for a virus."
15
- malicious_code = generate_text(prompt)
16
- print(malicious_code)
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  from transformers import GPT2LMHeadModel, GPT2Tokenizer
3
 
4
  # Load the pre-trained WormGPT model and tokenizer
 
11
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
12
  return generated_text
13
 
14
+ def predict(input_text):
15
+ output = generate_text(input_text)
16
+ return output
17
+
18
+ iface = gr.Interface(
19
+ fn=predict,
20
+ inputs=gr.Textbox(lines=2, placeholder="Enter your text here..."),
21
+ outputs="text",
22
+ title="WormGPT Text Generation",
23
+ description="Generate text using the WormGPT model."
24
+ )
25
+
26
+ iface.launch()