ganeshkamath89 commited on
Commit
d33bd1c
·
verified ·
1 Parent(s): d676c14

Moving the model to Interface.load function as first parameter

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -1,15 +1,10 @@
1
  import gradio as gr
2
- from 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(
8
- fn=generate_story,
9
  title="Story Generation with GPT-2",
10
  inputs=[gr.Textbox(lines=7, label="Story")],
11
  description="Story generation with GPT-2",
12
  examples=[["Adventurer is approached by a mysterious stranger in the tavern for a new quest"]],
13
- outputs=[gr.Textbox(label='News Summary Output')]
14
  )
15
  interface.launch()
 
1
  import gradio as gr
2
+ interface = gr.Interface.load(
3
+ "huggingface/pranavpsv/gpt2-genre-story-generator",
 
 
 
 
 
4
  title="Story Generation with GPT-2",
5
  inputs=[gr.Textbox(lines=7, label="Story")],
6
  description="Story generation with GPT-2",
7
  examples=[["Adventurer is approached by a mysterious stranger in the tavern for a new quest"]],
8
+ outputs=[gr.Textbox(label='Story Generation Output')]
9
  )
10
  interface.launch()