pragyaa commited on
Commit
22ffb1f
1 Parent(s): d5b8964

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -45
app.py CHANGED
@@ -1,46 +1,12 @@
1
  import gradio as gr
2
- import os
3
-
4
-
5
- def combine(a, b):
6
- return a + " " + b
7
-
8
-
9
- def mirror(x):
10
- return x
11
-
12
-
13
- with gr.Blocks() as demo:
14
-
15
- txt = gr.Textbox(label="Input", lines=2)
16
- txt_2 = gr.Textbox(label="Input 2")
17
- txt_3 = gr.Textbox(value="", label="Output")
18
- btn = gr.Button(value="Submit")
19
- btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])
20
-
21
- with gr.Row():
22
- im = gr.Image()
23
- im_2 = gr.Image()
24
-
25
- btn = gr.Button(value="Mirror Image")
26
- btn.click(mirror, inputs=[im], outputs=[im_2])
27
-
28
- gr.Markdown("## Text Examples")
29
- gr.Examples(
30
- [["hi", "Adam"], ["hello", "Eve"]],
31
- [txt, txt_2],
32
- txt_3,
33
- combine,
34
- cache_examples=True,
35
- )
36
- gr.Markdown("## Image Examples")
37
- gr.Examples(
38
- examples=[os.path.join(os.path.dirname(__file__), "lion.jpg")],
39
- inputs=im,
40
- outputs=im_2,
41
- fn=mirror,
42
- cache_examples=True,
43
- )
44
-
45
- if __name__ == "__main__":
46
- demo.launch()
 
1
  import gradio as gr
2
+ from gradio import inputs
3
+ description = "Story generation with GPT-2"
4
+ interface = gr.Interface.load("huggingface/pranavpsv/gpt2-genre-story-generator",
5
+ title = "Story Generation with GPT-2",
6
+ inputs = [
7
+ gr.inputs.Textbox(lines=7, label="Story"),
8
+ ],
9
+ description=description,
10
+ examples=[["Adventurer is approached by a mysterious stranger in the tavern for a new quest"]]
11
+ )
12
+ interface.launch()