Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
| 3 |
|
| 4 |
import requests
|
| 5 |
import re
|
|
|
|
| 6 |
|
| 7 |
import os
|
| 8 |
import random
|
|
@@ -67,6 +68,10 @@ def make_api_request():
|
|
| 67 |
match = re.search(r'"root"\s*:\s*"([^"]+)"', response.text)
|
| 68 |
api_url = match.group(1)
|
| 69 |
print(api_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
#------------------------------------------------------
|
| 71 |
|
| 72 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
@@ -208,6 +213,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 208 |
|
| 209 |
if __name__ == "__main__":
|
| 210 |
demo.queue(api_open=False)
|
| 211 |
-
|
| 212 |
# demo.queue(max_size=20).launch()
|
| 213 |
demo.launch()
|
|
|
|
| 3 |
|
| 4 |
import requests
|
| 5 |
import re
|
| 6 |
+
import threading
|
| 7 |
|
| 8 |
import os
|
| 9 |
import random
|
|
|
|
| 68 |
match = re.search(r'"root"\s*:\s*"([^"]+)"', response.text)
|
| 69 |
api_url = match.group(1)
|
| 70 |
print(api_url)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def delayed_api_request():
|
| 74 |
+
threading.Timer(120, make_api_request).start()
|
| 75 |
#------------------------------------------------------
|
| 76 |
|
| 77 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
|
|
| 213 |
|
| 214 |
if __name__ == "__main__":
|
| 215 |
demo.queue(api_open=False)
|
| 216 |
+
delayed_api_request()
|
| 217 |
# demo.queue(max_size=20).launch()
|
| 218 |
demo.launch()
|