Spaces:
Runtime error
Runtime error
Commit
•
31d5745
1
Parent(s):
eab793d
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,17 @@
|
|
1 |
-
|
2 |
-
from diffusers import StableDiffusionPipeline
|
3 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# Provide the url to model id
|
6 |
url = "runwayml/stable-diffusion-v1-5"
|
7 |
|
8 |
-
# Load the safetensor model
|
9 |
-
pipe = DiffusionPipeline.from_pretrained(
|
10 |
pipe = pipe.to("mps")
|
11 |
|
12 |
def predict(text):
|
@@ -15,7 +20,6 @@ def predict(text):
|
|
15 |
return generated_image
|
16 |
|
17 |
|
18 |
-
|
19 |
iface = gr.Interface(
|
20 |
fn=predict,
|
21 |
inputs='text',
|
|
|
1 |
+
# text to Image on Gradio UI
|
|
|
2 |
import torch
|
3 |
+
from diffusers import DiffusionPipeline
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
|
7 |
+
# Provide the file path to your locally stored model file
|
8 |
+
model_file_path = "/model/file/path/to/model/directory/"
|
9 |
|
10 |
# Provide the url to model id
|
11 |
url = "runwayml/stable-diffusion-v1-5"
|
12 |
|
13 |
+
# Load the safetensor model
|
14 |
+
pipe = DiffusionPipeline.from_pretrained(url, torch_dtype=torch.float16)
|
15 |
pipe = pipe.to("mps")
|
16 |
|
17 |
def predict(text):
|
|
|
20 |
return generated_image
|
21 |
|
22 |
|
|
|
23 |
iface = gr.Interface(
|
24 |
fn=predict,
|
25 |
inputs='text',
|