Kvikontent commited on
Commit
7979503
·
1 Parent(s): a7951ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -1,15 +1,27 @@
1
  import gradio as gr
2
  from diffusers import DiffusionPipeline
3
 
4
- pipeline = DiffusionPipeline.from_pretrained("dataautogpt3/OpenDalleV1.1")
 
 
5
 
 
6
  def generate_image(prompt):
7
- if prompt != '':
8
- image = pipeline.generate(prompt=prompt)
9
- return image
10
- else:
11
- return None
12
 
13
- prompt_input = gr.Textbox(label="Enter your prompt here:")
 
 
14
 
15
- gr.Interface(generate_image, inputs=gr.Textbox(lines=5), outputs=gr.Image(label="Generated Image")).launch()
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from diffusers import DiffusionPipeline
3
 
4
+ # Initialize the DiffusionPipeline with the specified model
5
+ pipeline = DiffusionPipeline.from_pretrained("stablediffusionapi/juggernaut-xl-v5")
6
+ pipeline.load_lora_weights("openskyml/dalle-3-xl")
7
 
8
+ # Function to generate image based on the prompt
9
  def generate_image(prompt):
10
+ image = pipeline(prompt).images[0]
11
+ return image
 
 
 
12
 
13
+ # Define the Gradio interface layout
14
+ prompt_input = gr.textbox(label="", placeholder="Enter your prompt here...", lines=1, unresizeable=False)
15
+ image_output = gr.Image(label="Generated Image")
16
 
17
+ # Create the Gradio interface with a more organized layout
18
+ gr.Interface(
19
+ fn=generate_image,
20
+ inputs=gr.Textbox(lines=5, label="Enter Prompt", placeholder="Enter your prompt here..."),
21
+ outputs="image",
22
+ title="OpenJourney Image Generation",
23
+ theme="compact", # Use a more compact theme for the interface
24
+ layout="vertical", # Arrange the interface components vertically
25
+ inputs=[prompt_input],
26
+ outputs=image_output
27
+ ).launch()