updated scripts for two outputs
Browse files
app.py
CHANGED
@@ -54,15 +54,16 @@ def generate_text_with_nucleus_search(input_text, max_length=16, do_sample=True,
|
|
54 |
output = model.generate(input_ids, max_length=max_length, do_sample=do_sample, top_p=top_p)
|
55 |
# Decode the generated output
|
56 |
generated_text = tokenizer.decode(output[0])
|
57 |
-
return
|
58 |
|
59 |
|
60 |
# Create Gradio interface
|
61 |
input_text = gr.Textbox(lines=10, label="Input Text", placeholder="Enter text for text generation...")
|
62 |
-
|
|
|
63 |
|
64 |
|
65 |
-
gr.Interface(generate_text, input_text,
|
66 |
title="Text Generation with GPT-2",
|
67 |
description="Generate text using the GPT-2 model.",
|
68 |
theme="default", # Change theme to default
|
|
|
54 |
output = model.generate(input_ids, max_length=max_length, do_sample=do_sample, top_p=top_p)
|
55 |
# Decode the generated output
|
56 |
generated_text = tokenizer.decode(output[0])
|
57 |
+
return generate_text_with_nucleus_search
|
58 |
|
59 |
|
60 |
# Create Gradio interface
|
61 |
input_text = gr.Textbox(lines=10, label="Input Text", placeholder="Enter text for text generation...")
|
62 |
+
output_text1 = gr.Textbox(label="Generated Text")
|
63 |
+
output_text2 = gr.Textbox(lable="generate_text_with_nucleus_search")
|
64 |
|
65 |
|
66 |
+
gr.Interface(generate_text, input_text, output_text1,output_text2,
|
67 |
title="Text Generation with GPT-2",
|
68 |
description="Generate text using the GPT-2 model.",
|
69 |
theme="default", # Change theme to default
|