kayfahaarukku commited on
Commit
b9ea548
·
verified ·
1 Parent(s): c9c788f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,10 +1,10 @@
1
  import os
2
- import spaces
3
  import torch
4
  from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
5
  import gradio as gr
6
  import random
7
  import tqdm
 
8
 
9
  # Enable TQDM progress tracking
10
  tqdm.monitor_interval = 0
@@ -19,7 +19,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
19
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
20
 
21
  # Function to generate an image
22
- @spaces.GPU() # Adjust the duration as needed
23
  def generate_image(prompt, negative_prompt, use_defaults, resolution, guidance_scale, num_inference_steps, seed, randomize_seed, progress=gr.Progress()):
24
  pipe.to('cuda') # Move the model to GPU when the function is called
25
 
@@ -103,4 +102,8 @@ with gr.Blocks(title="UrangDiffusion 1.0 Demo", theme="NoCrypt/[email protected]") as d
103
  ]
104
  )
105
 
106
- demo.queue(max_size=20).launch(share=True)
 
 
 
 
 
1
  import os
 
2
  import torch
3
  from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
4
  import gradio as gr
5
  import random
6
  import tqdm
7
+ from pyngrok import ngrok
8
 
9
  # Enable TQDM progress tracking
10
  tqdm.monitor_interval = 0
 
19
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
20
 
21
  # Function to generate an image
 
22
  def generate_image(prompt, negative_prompt, use_defaults, resolution, guidance_scale, num_inference_steps, seed, randomize_seed, progress=gr.Progress()):
23
  pipe.to('cuda') # Move the model to GPU when the function is called
24
 
 
102
  ]
103
  )
104
 
105
+ # Set up ngrok
106
+ public_url = ngrok.connect(api_key=NGROK_API_KEY)
107
+ print(f"Public URL: {public_url}")
108
+
109
+ demo.queue(max_size=20).launch(server_name="0.0.0.0", server_port=7860)