yukimama commited on
Commit
096a14b
·
verified ·
1 Parent(s): 496f43c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -9,7 +9,7 @@ tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
9
  tokenizer.pad_token = tokenizer.eos_token
10
 
11
  def generate_command(prompt, max_length=100):
12
- full_prompt = f"Generate a command for {prompt}:```bash\n"
13
  inputs = tokenizer.encode(full_prompt, return_tensors="pt")
14
 
15
  output = model.generate(
@@ -36,10 +36,10 @@ def predict(input_text):
36
 
37
  iface = gr.Interface(
38
  fn=predict,
39
- inputs=gr.Textbox(lines=2, placeholder="Enter your command generation prompt here..."),
40
  outputs="text",
41
- title="Command Generation with GPT2",
42
- description="Generate bash commands based on your input prompt."
43
  )
44
 
45
  iface.launch()
 
9
  tokenizer.pad_token = tokenizer.eos_token
10
 
11
  def generate_command(prompt, max_length=100):
12
+ full_prompt = f"生成一個Bash指令,用於{prompt}:```bash\n"
13
  inputs = tokenizer.encode(full_prompt, return_tensors="pt")
14
 
15
  output = model.generate(
 
36
 
37
  iface = gr.Interface(
38
  fn=predict,
39
+ inputs=gr.Textbox(lines=2, placeholder="請輸入你的指令生成提示..."),
40
  outputs="text",
41
+ title="使用 GPT2 生成指令",
42
+ description="根據你的中文輸入提示生成 Bash 指令。"
43
  )
44
 
45
  iface.launch()