mikaelbhai commited on
Commit
284d585
·
1 Parent(s): 4fbdd17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -1,35 +1,20 @@
1
- import os
2
  import gradio as gr
3
  import requests
4
  from PIL import Image
5
  import io
6
  import numpy as np
7
 
8
- api_key = 'sk-CED85fi0ZhUDMWg4GvFQ5k53o7yoL7WOaPyPQcb8zPi7eDGi' # your Stability AI API key
9
 
10
- def stable_diffusion(user_input):
11
- prompt = user_input
12
- print("Prompt:", prompt)
13
-
14
- # Create the Stable Difusion image using the Stability AI API
15
  response = requests.post(
16
- 'https://api.stability.ai/v1/image/generate',
17
  headers={'Authorization': f'Bearer {api_key}'},
18
  json={
19
- 'text': prompt,
20
- 'model': 'sd-c2',
21
- 'steps': 200,
22
- 'size': 512,
23
- 'start_size': 64,
24
- 'start_scale': 1,
25
- 'end_scale': 0.25,
26
- 'deterministic': False,
27
- 'clip': False,
28
- 'top_k': 0,
29
- 'top_p': 1,
30
- 'temperature': 1,
31
- 'seed': None,
32
- 'noise_seed': None,
33
  }
34
  )
35
  response.raise_for_status()
@@ -41,5 +26,5 @@ def stable_diffusion(user_input):
41
 
42
  return img_arr
43
 
44
- iface = gr.Interface(fn=stable_diffusion, inputs="text", outputs="image", title="bhAI (text to image)")
45
  iface.launch()
 
1
+
2
  import gradio as gr
3
  import requests
4
  from PIL import Image
5
  import io
6
  import numpy as np
7
 
8
+ api_key = "sk-CED85fi0ZhUDMWg4GvFQ5k53o7yoL7WOaPyPQcb8zPi7eDGi"
9
 
10
+ def dream_studio(user_input):
11
+ # Create the Dream Studio image
 
 
 
12
  response = requests.post(
13
+ 'https://beta.dreamstudio.ai/api/creations/images/generate',
14
  headers={'Authorization': f'Bearer {api_key}'},
15
  json={
16
+ 'model': 'biggan-deep-256',
17
+ 'text': user_input
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
  )
20
  response.raise_for_status()
 
26
 
27
  return img_arr
28
 
29
+ iface = gr.Interface(fn=dream_studio, inputs="text", outputs="image", title="bhAI (text to image)")
30
  iface.launch()