Update app.py
Browse files
app.py
CHANGED
@@ -12,5 +12,13 @@ def generate(commentary_text):
|
|
12 |
output = trained_model.generate(input_ids, max_length=60, num_beams=5, do_sample=False)
|
13 |
return tokenizer_finetuned.decode(output[0])
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
output = trained_model.generate(input_ids, max_length=60, num_beams=5, do_sample=False)
|
13 |
return tokenizer_finetuned.decode(output[0])
|
14 |
|
15 |
+
# Create Gradio interface
|
16 |
+
iface = gr.Interface(fn=generate_text,
|
17 |
+
inputs="text",
|
18 |
+
outputs="text",
|
19 |
+
title="GPT-2 Text Generation",
|
20 |
+
description="Enter a prompt and GPT-2 will generate the continuation of the text.")
|
21 |
+
|
22 |
+
# Launch the app
|
23 |
+
if __name__ == "__main__":
|
24 |
+
iface.launch()
|