Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
import os
|
2 |
import random
|
3 |
-
|
4 |
import gradio as gr
|
5 |
from gradio_client import Client, file
|
6 |
import numpy as np
|
7 |
from PIL import Image
|
8 |
from typing import Tuple
|
9 |
from translatepy import Translator
|
|
|
10 |
|
11 |
MODEL = os.environ.get("MODEL")
|
12 |
MODEL2 = os.environ.get("MODEL2")
|
@@ -108,16 +109,19 @@ def generate(
|
|
108 |
fn_index=1
|
109 |
)
|
110 |
print(result)
|
111 |
-
|
|
|
|
|
112 |
else:
|
113 |
seed = 0
|
114 |
-
|
115 |
prompt,
|
116 |
-
|
117 |
7.5,
|
118 |
"(No style)",
|
119 |
fn_index=3
|
120 |
)
|
|
|
121 |
print(result)
|
122 |
images = result["data"][0]
|
123 |
|
|
|
1 |
import os
|
2 |
import random
|
3 |
+
import requests
|
4 |
import gradio as gr
|
5 |
from gradio_client import Client, file
|
6 |
import numpy as np
|
7 |
from PIL import Image
|
8 |
from typing import Tuple
|
9 |
from translatepy import Translator
|
10 |
+
from io import BytesIO
|
11 |
|
12 |
MODEL = os.environ.get("MODEL")
|
13 |
MODEL2 = os.environ.get("MODEL2")
|
|
|
109 |
fn_index=1
|
110 |
)
|
111 |
print(result)
|
112 |
+
image_url = MODEL+"file="+result
|
113 |
+
response = requests.get(image_url)
|
114 |
+
images = Image.open(BytesIO(response.content))
|
115 |
else:
|
116 |
seed = 0
|
117 |
+
job = client2.submit(
|
118 |
prompt,
|
119 |
+
"",
|
120 |
7.5,
|
121 |
"(No style)",
|
122 |
fn_index=3
|
123 |
)
|
124 |
+
result = job.result()
|
125 |
print(result)
|
126 |
images = result["data"][0]
|
127 |
|