aadarsh-af commited on
Commit
cb0f5a4
·
1 Parent(s): c9591a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -1,7 +1,22 @@
1
  import gradio as gr
 
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
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()