Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
url = "https://api.prodia.com/v1/job"
|
5 |
+
|
6 |
+
headers = {
|
7 |
+
"accept": "application/json",
|
8 |
+
"content-type": "application/json",
|
9 |
+
"X-Prodia-Key": "69e66898-010d-4cd1-9e22-090f73ad007b"
|
10 |
+
}
|
11 |
+
|
12 |
+
response = requests.post(url, headers=headers)
|
13 |
+
|
14 |
+
print(response.text)
|
15 |
+
#generator = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
|
16 |
+
|
17 |
+
def generate(prompts):
|
18 |
+
images = generator(list(prompts)).images
|
19 |
+
return [images]
|
20 |
+
|
21 |
+
demo = gr.Interface(generate,
|
22 |
+
"textbox",
|
23 |
+
"image",
|
24 |
+
batch=True,
|
25 |
+
max_batch_size=4 # Set the batch size based on your CPU/GPU memory
|
26 |
+
).queue()
|
27 |
+
|
28 |
+
if __name__ == "__main__":
|
29 |
+
demo.launch()
|