Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ from google.genai import types
|
|
12 |
import concurrent.futures
|
13 |
import random
|
14 |
from typing import List, Tuple, Optional
|
|
|
15 |
|
16 |
def save_binary_file(file_name, data):
|
17 |
with open(file_name, "wb") as f:
|
@@ -173,6 +174,17 @@ def process_image_and_prompt(composite_pil, prompt):
|
|
173 |
except Exception as e:
|
174 |
return None, f"خطا در پردازش: {e}"
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
css = """
|
177 |
footer { visibility: hidden; }
|
178 |
[class="flagging"], [id*="flagging"],
|
|
|
12 |
import concurrent.futures
|
13 |
import random
|
14 |
from typing import List, Tuple, Optional
|
15 |
+
import threading
|
16 |
|
17 |
def save_binary_file(file_name, data):
|
18 |
with open(file_name, "wb") as f:
|
|
|
174 |
except Exception as e:
|
175 |
return None, f"خطا در پردازش: {e}"
|
176 |
|
177 |
+
# تابع جدید برای ریست خودکار هر 24 ساعت
|
178 |
+
def auto_restart():
|
179 |
+
while True:
|
180 |
+
time.sleep(24 * 60 * 60) # 24 ساعت
|
181 |
+
print("ریست خودکار Space پس از 24 ساعت")
|
182 |
+
os._exit(1)
|
183 |
+
|
184 |
+
# شروع ترد ریست خودکار
|
185 |
+
restart_thread = threading.Thread(target=auto_restart, daemon=True)
|
186 |
+
restart_thread.start()
|
187 |
+
|
188 |
css = """
|
189 |
footer { visibility: hidden; }
|
190 |
[class="flagging"], [id*="flagging"],
|