Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
|
|
|
|
|
|
| 4 |
|
| 5 |
text_gen = gr.Interface.load(name="spaces/Gustavosta/MagicPrompt-Stable-Diffusion")
|
| 6 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def get_images(prompt):
|
| 9 |
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
| 10 |
sd_output = [os.path.join(gallery_dir, image) for image in os.listdir(gallery_dir)]
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 4 |
+
import urllib.request
|
| 5 |
+
import shutil
|
| 6 |
|
| 7 |
text_gen = gr.Interface.load(name="spaces/Gustavosta/MagicPrompt-Stable-Diffusion")
|
| 8 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 9 |
|
| 10 |
+
|
| 11 |
+
def imp():
|
| 12 |
+
url = "https://i.imgur.com/oer58GE.png"
|
| 13 |
+
output_file = "save_this_name.png"
|
| 14 |
+
with urllib.request.urlopen(url) as response, open(output_file, 'wb') as out_file:
|
| 15 |
+
shutil.copyfileobj(response, out_file)
|
| 16 |
+
|
| 17 |
def get_images(prompt):
|
| 18 |
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
| 19 |
sd_output = [os.path.join(gallery_dir, image) for image in os.listdir(gallery_dir)]
|