cedpsam commited on
Commit
eb357c6
·
verified ·
1 Parent(s): d686bf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,5 +1,8 @@
1
  import gradio_client
2
  from gradio_client import Client, file
 
 
 
3
  import numpy as np
4
  import gradio as gr
5
  def generate_img(prompt):
@@ -11,7 +14,10 @@ def generate_img(prompt):
11
  )
12
  return result
13
 
14
-
 
 
 
15
 
16
  def interrogate(img):
17
  from gradio_client import Client
@@ -28,7 +34,8 @@ def interrogate(img):
28
  return result
29
  def rountrip(img):
30
  prompt=interrogate(img)
31
- return generate_img(prompt),prompt
 
32
 
33
- demo = gr.Interface(rountrip, gr.Image(type= 'filepath'),[gr.Image(type= 'filepath'),"textbox"])
34
  demo.launch()
 
1
  import gradio_client
2
  from gradio_client import Client, file
3
+ from urllib.parse import quote
4
+
5
+
6
  import numpy as np
7
  import gradio as gr
8
  def generate_img(prompt):
 
14
  )
15
  return result
16
 
17
+ def pollinations_url_seedless(a, width=512, height=512):
18
+ urlprompt=quote(a)
19
+ url=f"https://image.pollinations.ai/prompt/{urlprompt}?width={width}&height={height}"
20
+ return url
21
 
22
  def interrogate(img):
23
  from gradio_client import Client
 
34
  return result
35
  def rountrip(img):
36
  prompt=interrogate(img)
37
+ url=pollinations_url_seedless(url)
38
+ return generate_img(prompt),prompt,url
39
 
40
+ demo = gr.Interface(rountrip, gr.Image(type= 'filepath'),[gr.Image(type= 'filepath'),"textbox",gr.Image(type= 'filepath')])
41
  demo.launch()