Spaces:
Runtime error
Runtime error
azaninello
commited on
Commit
•
be63c93
1
Parent(s):
658a608
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import transformers
|
3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
4 |
+
|
5 |
+
shroom_generator = pipeline("text-generation", model=AutoModelForCausalLM.from_pretrained('LorenzoDeMattei/GePpeTto'), tokenizer="gpt2")
|
6 |
+
|
7 |
+
def generator(inizia_la_storia = ''):
|
8 |
+
shroom_result = shroom_generator(inizia_la_storia, max_length=420)
|
9 |
+
return shroom_result[0]["generated_text"]
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=generator, inputs="text", outputs="text")
|
12 |
+
iface.launch()
|