Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,14 @@ import sys
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
def download_file(url):
|
|
|
|
|
|
|
|
|
|
| 8 |
filename = str(random.randint(111111111, 999999999)) + ".png"
|
| 9 |
|
| 10 |
file_path = os.path.join(os.path.dirname(__file__), filename)
|
| 11 |
|
| 12 |
-
response = requests.get(
|
| 13 |
|
| 14 |
if response.status_code == 200:
|
| 15 |
|
|
@@ -19,8 +22,5 @@ def download_file(url):
|
|
| 19 |
|
| 20 |
return(file_path)
|
| 21 |
|
| 22 |
-
def process(prompt):
|
| 23 |
-
download_file("https://image.pollinations.ai/prompt/" + prompt + ('.' * random.randint(0, 100)))
|
| 24 |
-
|
| 25 |
iface = gr.Interface(fn=process, inputs="text", outputs="image")
|
| 26 |
iface.launch()
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
def download_file(url):
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def process(prompt):
|
| 11 |
filename = str(random.randint(111111111, 999999999)) + ".png"
|
| 12 |
|
| 13 |
file_path = os.path.join(os.path.dirname(__file__), filename)
|
| 14 |
|
| 15 |
+
response = requests.get("https://image.pollinations.ai/prompt/" + prompt + ('.' * random.randint(0, 100)))
|
| 16 |
|
| 17 |
if response.status_code == 200:
|
| 18 |
|
|
|
|
| 22 |
|
| 23 |
return(file_path)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
iface = gr.Interface(fn=process, inputs="text", outputs="image")
|
| 26 |
iface.launch()
|