Spaces:
Runtime error
Runtime error
Commit ·
cb0f5a4
1
Parent(s): c9591a9
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import baseten
|
| 3 |
+
from baseten.models import StableDiffusionPipeline
|
| 4 |
+
import os
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
load_dotenv()
|
| 7 |
|
| 8 |
+
BASETEN_API_KEY = os.getenv("BASETEN_API_KEY")
|
| 9 |
+
baseten.login(BASETEN_API_KEY)
|
| 10 |
|
| 11 |
+
model = StableDiffusionPipeline(
|
| 12 |
+
"runwayml/stable-diffusion-v1-5",
|
| 13 |
+
vae="stabilityai/sd-vae-ft-mse",
|
| 14 |
+
scheduler="pndm"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
def t2i(text):
|
| 18 |
+
image, url = model(text)
|
| 19 |
+
return url
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(fn=t2i, inputs="text", outputs="image").launch()
|
| 22 |
iface.launch()
|