Spaces:
Runtime error
Runtime error
Commit
•
5ad9463
1
Parent(s):
5148c3e
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
4 |
|
5 |
shroom_generator = pipeline("text-generation", model=AutoModelForCausalLM.from_pretrained('azaninello/gpt2-finetuned-shrooms'), tokenizer="gpt2")
|
6 |
|
7 |
-
def generator(
|
8 |
-
shroom_result = shroom_generator(
|
9 |
-
#general_result = general_generator(input_text, max_length=420)
|
10 |
return shroom_result[0]["generated_text"]
|
11 |
|
12 |
iface = gr.Interface(fn=generator, inputs="text", outputs="text")
|
|
|
4 |
|
5 |
shroom_generator = pipeline("text-generation", model=AutoModelForCausalLM.from_pretrained('azaninello/gpt2-finetuned-shrooms'), tokenizer="gpt2")
|
6 |
|
7 |
+
def generator(scrivi_un_titolo = ""):
|
8 |
+
shroom_result = shroom_generator(f"<|HEADLINE|>{scrivi_un_titolo}<|TEXT|>", max_length=420)
|
|
|
9 |
return shroom_result[0]["generated_text"]
|
10 |
|
11 |
iface = gr.Interface(fn=generator, inputs="text", outputs="text")
|