Update app.py
Browse files
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"
|
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="
|
40 |
outputs="text",
|
41 |
-
title="
|
42 |
-
description="
|
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()
|