Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import os
|
|
|
2 |
import random
|
|
|
3 |
import requests
|
4 |
import gradio as gr
|
5 |
from gradio_client import Client, file
|
@@ -111,24 +113,30 @@ def generate(
|
|
111 |
)
|
112 |
print(result)
|
113 |
image_url = MODEL+"file="+result
|
114 |
-
|
115 |
-
print(f'A:{
|
116 |
-
|
117 |
-
|
118 |
-
images
|
119 |
else:
|
120 |
seed = 0
|
121 |
job = client2.submit(
|
122 |
prompt,
|
123 |
-
"",
|
124 |
7.5,
|
125 |
"(No style)",
|
126 |
fn_index=3
|
127 |
)
|
128 |
result = job.result()
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
return images, seed
|
133 |
|
134 |
examples = [
|
|
|
1 |
import os
|
2 |
+
import re
|
3 |
import random
|
4 |
+
import json
|
5 |
import requests
|
6 |
import gradio as gr
|
7 |
from gradio_client import Client, file
|
|
|
113 |
)
|
114 |
print(result)
|
115 |
image_url = MODEL+"file="+result
|
116 |
+
images_request = requests.get(image_url)
|
117 |
+
print(f'A:{images_request}')
|
118 |
+
pil_image = Image.open(BytesIO(images_request.content))
|
119 |
+
images.append(pil_image)
|
120 |
+
print(f'B:{images}')
|
121 |
else:
|
122 |
seed = 0
|
123 |
job = client2.submit(
|
124 |
prompt,
|
125 |
+
"low_quality",
|
126 |
7.5,
|
127 |
"(No style)",
|
128 |
fn_index=3
|
129 |
)
|
130 |
result = job.result()
|
131 |
+
for file in os.listdir(result):
|
132 |
+
print(file)
|
133 |
+
json_file = os.path.join(result,config.json)
|
134 |
+
while open(json_file, 'r') as f:
|
135 |
+
json_data = json.load(f)
|
136 |
+
json_data = json.loads(json_data)
|
137 |
+
print(json_data)
|
138 |
+
from img in json_data["data"]:
|
139 |
+
images.append(img)
|
140 |
return images, seed
|
141 |
|
142 |
examples = [
|