mertol1 commited on
Commit
8c00444
1 Parent(s): adaa93a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,11 +1,15 @@
1
  import gradio as gr
 
2
 
3
  def generate_image(prompt):
4
- # Burada, Stable Diffusion gibi ücretsiz ve popüler bir AI modelini kullanabilirsiniz.
5
- # Ancak, bu modellerin API'leri genellikle ücretlidir.
6
- # Ücretsiz bir alternatif olarak, "DeepAI" adlı bir servisi kullanabiliriz.
7
- result = gr.load("https://deepai.org/machine-learning-model/text2img")
8
- return result(prompt)
 
 
 
9
 
10
  iface = gr.Interface(
11
  generate_image,
 
1
  import gradio as gr
2
+ import requests
3
 
4
  def generate_image(prompt):
5
+ r = requests.post(
6
+ "https://api.deepai.org/api/text2img",
7
+ data={
8
+ 'text': prompt,
9
+ },
10
+ headers={'api-key': '5afe345e-57fd-4fd7-8a77-d06ce59f07ad'}
11
+ )
12
+ return r.json()['output_url']
13
 
14
  iface = gr.Interface(
15
  generate_image,