Spaces:
Runtime error
Runtime error
Commit
·
940a925
1
Parent(s):
4a73852
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,10 @@
|
|
1 |
import os
|
2 |
-
os.system("pip install baseten")
|
3 |
-
os.system("pip install python-dotenv")
|
4 |
import gradio as gr
|
5 |
-
import baseten
|
6 |
-
from baseten.models import StableDiffusionPipeline
|
7 |
-
from dotenv import load_dotenv
|
8 |
-
load_dotenv()
|
9 |
-
|
10 |
-
BASETEN_API_KEY = os.getenv("BASETEN_API_KEY")
|
11 |
-
baseten.login(BASETEN_API_KEY)
|
12 |
-
|
13 |
-
model = StableDiffusionPipeline(
|
14 |
-
"runwayml/stable-diffusion-v1-5",
|
15 |
-
vae="stabilityai/sd-vae-ft-mse",
|
16 |
-
scheduler="pndm"
|
17 |
-
)
|
18 |
|
19 |
def t2i(text):
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
iface = gr.Interface(fn=t2i, inputs="text", outputs=[gr.Image(label="Generated Image")]).launch()
|
24 |
iface.launch(share=True)
|
|
|
1 |
import os
|
|
|
|
|
2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
def t2i(text):
|
5 |
+
prompt_url = f"https://aadarsh-text-to-image-mymvubi2mq-el.a.run.app/t2i/{text}"
|
6 |
+
url = requests.get(prompt_url).json()["url"]
|
7 |
+
return url
|
8 |
|
9 |
iface = gr.Interface(fn=t2i, inputs="text", outputs=[gr.Image(label="Generated Image")]).launch()
|
10 |
iface.launch(share=True)
|