Spaces:
Runtime error
Runtime error
Luis Oala
commited on
Commit
·
531771c
1
Parent(s):
d499041
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio import mix
|
|
|
3 |
|
4 |
#title = "trustworthy artificial intelligence workshop - content generator"
|
5 |
description = "based on the gpt2 demo interface by <a href='https://huggingface.co/spaces/docs-demos/gpt2/tree/main'>ahsen khaliq</a>"
|
6 |
|
7 |
#io1 = gr.Interface.load("huggingface/distilgpt2")
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
set_seed(42)
|
12 |
|
13 |
|
14 |
io2 = gr.Interface.load("huggingface/gpt2-large")
|
@@ -29,8 +29,8 @@ def inference(text, model):
|
|
29 |
else:
|
30 |
outtext = io1(text)
|
31 |
"""
|
32 |
-
|
33 |
-
outtext = generator(text, max_length=30, num_return_sequences=5)
|
34 |
return outtext
|
35 |
|
36 |
|
|
|
1 |
import gradio as gr
|
2 |
from gradio import mix
|
3 |
+
from transformers import pipeline, set_seed
|
4 |
|
5 |
#title = "trustworthy artificial intelligence workshop - content generator"
|
6 |
description = "based on the gpt2 demo interface by <a href='https://huggingface.co/spaces/docs-demos/gpt2/tree/main'>ahsen khaliq</a>"
|
7 |
|
8 |
#io1 = gr.Interface.load("huggingface/distilgpt2")
|
9 |
|
10 |
+
#generator = pipeline('text-generation', model='gpt2')
|
11 |
+
#set_seed(42)
|
|
|
12 |
|
13 |
|
14 |
io2 = gr.Interface.load("huggingface/gpt2-large")
|
|
|
29 |
else:
|
30 |
outtext = io1(text)
|
31 |
"""
|
32 |
+
outtext = io2(text, max_length=60)
|
33 |
+
#outtext = generator(text, max_length=30, num_return_sequences=5)
|
34 |
return outtext
|
35 |
|
36 |
|