Spaces:
Runtime error
Runtime error
Updating the code to use Hugging Face Text Generation pipeline
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
7 |
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
transformers import pipeline
|
3 |
+
def generate_story(story):
|
4 |
+
story_gen = pipeline("text-generation", "pranavpsv/gpt2-genre-story-generator")
|
5 |
+
generated_story = story_gen("<BOS> <superhero> Batman")
|
6 |
+
return generated_story
|
7 |
+
interface = gr.Interface(fn=generate_story, title="Story Generation with GPT-2", inputs=[gr.Textbox(lines=7, label="Story")], description="Story generation with GPT-2", examples=[["Adventurer is approached by a mysterious stranger in the tavern for a new quest"]])
|
8 |
interface.launch()
|