Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,10 +18,9 @@ from PIL import Image
|
|
| 18 |
import io
|
| 19 |
|
| 20 |
URL="http://127.0.0.1"
|
| 21 |
-
OUTPUT_DIR
|
| 22 |
-
INPUT_DIR
|
| 23 |
-
|
| 24 |
-
|
| 25 |
import torch
|
| 26 |
|
| 27 |
import spaces
|
|
@@ -85,7 +84,7 @@ def check_server_ready(port):
|
|
| 85 |
def generate_image(image):
|
| 86 |
prefix_filename = str(random.randint(0, 999999))
|
| 87 |
prompt = read_prompt_from_file('good_upscaler.json')
|
| 88 |
-
prompt = json.dumps(prompt, ensure_ascii=False).replace('
|
| 89 |
prompt = json.loads(prompt)
|
| 90 |
|
| 91 |
image = Image.fromarray(image)
|
|
@@ -95,7 +94,7 @@ def generate_image(image):
|
|
| 95 |
new_port = str(random.randint(8123, 8200))
|
| 96 |
|
| 97 |
try:
|
| 98 |
-
process = subprocess.Popen([sys.executable,
|
| 99 |
logger.debug(f'Subprocess started with PID: {process.pid}')
|
| 100 |
|
| 101 |
for _ in range(40):
|
|
|
|
| 18 |
import io
|
| 19 |
|
| 20 |
URL="http://127.0.0.1"
|
| 21 |
+
OUTPUT_DIR="Backend/output"
|
| 22 |
+
INPUT_DIR="Backend/input"
|
| 23 |
+
BACKEND_PATH="Backend/main.py"
|
|
|
|
| 24 |
import torch
|
| 25 |
|
| 26 |
import spaces
|
|
|
|
| 84 |
def generate_image(image):
|
| 85 |
prefix_filename = str(random.randint(0, 999999))
|
| 86 |
prompt = read_prompt_from_file('good_upscaler.json')
|
| 87 |
+
prompt = json.dumps(prompt, ensure_ascii=False).replace('OutPutImage', prefix_filename)
|
| 88 |
prompt = json.loads(prompt)
|
| 89 |
|
| 90 |
image = Image.fromarray(image)
|
|
|
|
| 94 |
new_port = str(random.randint(8123, 8200))
|
| 95 |
|
| 96 |
try:
|
| 97 |
+
process = subprocess.Popen([sys.executable, BACKEND_PATH, "--listen", "127.0.0.1", "--port", new_port])
|
| 98 |
logger.debug(f'Subprocess started with PID: {process.pid}')
|
| 99 |
|
| 100 |
for _ in range(40):
|