Gokul14 commited on
Commit
d69adc3
1 Parent(s): e1eac54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -32
app.py CHANGED
@@ -1,36 +1,12 @@
1
- from diffusers import AutoPipelineForText2Image
2
- import torch
3
-
4
- pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16").to("cuda")
5
-
6
- import os
7
- import shlex
8
- import subprocess
9
- from pathlib import Path
10
- from typing import Union
11
-
12
  import gradio as gr
13
 
14
- def generate(prompt):
15
- image = pipe(prompt, num_inference_steps=1, guidance_scale=0.0, width=512, height=512).images[0]
16
- return image.resize((512, 512))
17
-
18
- with gr.Blocks(title=f"Realtime SDXL Turbo", css=".gradio-container {max-width: 544px !important}") as demo:
19
- with gr.Row():
20
- with gr.Column():
21
- textbox = gr.Textbox(show_label=False, value="a close-up picture of a fluffy cat")
22
- button = gr.Button()
23
- with gr.Row(variant="default"):
24
- output_image = gr.Image(
25
- show_label=False,
26
- type="pil",
27
- interactive=False,
28
- height=512,
29
- width=512,
30
- elem_id="output_image",
31
- )
32
 
33
- # textbox.change(fn=generate, inputs=[textbox], outputs=[output_image], show_progress=False)
34
- button.click(fn=generate, inputs=[textbox], outputs=[output_image], show_progress=False)
 
 
35
 
36
- demo.queue().launch(inline=False, share=True, debug=True)
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ description = "Story generation with GPT-2"
4
+ title = "Generate your own story"
5
+ examples = [["Adventurer is approached by a mysterious stranger in the tavern for a new quest."]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ interface = gr.Interface.load("huggingface/pranavpsv/gpt2-genre-story-generator",
8
+ description=description,
9
+ examples=examples
10
+ )
11
 
12
+ interface.launch()