Update app.py
Browse files
app.py
CHANGED
|
@@ -498,7 +498,7 @@ Output ONLY Python code, no markdown.
|
|
| 498 |
{"role": "system", "content": "Output only clean executable Python code with comprehensive error handling."},
|
| 499 |
{"role": "user", "content": prompt}
|
| 500 |
],
|
| 501 |
-
max_tokens=
|
| 502 |
temperature=0.1 if attempt == 1 else 0.3 # Increase creativity on retries
|
| 503 |
)
|
| 504 |
|
|
@@ -803,11 +803,21 @@ if __name__ == "__main__":
|
|
| 803 |
# Cleanup old sessions on startup
|
| 804 |
session_manager.cleanup_old_sessions()
|
| 805 |
|
| 806 |
-
# Launch with concurrency settings
|
| 807 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
demo.launch(
|
| 809 |
share=True,
|
| 810 |
-
server_name="0.0.0.0",
|
| 811 |
server_port=7860,
|
| 812 |
show_error=True
|
| 813 |
)
|
|
|
|
| 498 |
{"role": "system", "content": "Output only clean executable Python code with comprehensive error handling."},
|
| 499 |
{"role": "user", "content": prompt}
|
| 500 |
],
|
| 501 |
+
max_tokens=4000,
|
| 502 |
temperature=0.1 if attempt == 1 else 0.3 # Increase creativity on retries
|
| 503 |
)
|
| 504 |
|
|
|
|
| 803 |
# Cleanup old sessions on startup
|
| 804 |
session_manager.cleanup_old_sessions()
|
| 805 |
|
| 806 |
+
# Launch with concurrency settings - روش سازگار با تمام نسخههای Gradio
|
| 807 |
+
try:
|
| 808 |
+
# روش ۱: برای نسخههای جدید Gradio
|
| 809 |
+
demo.queue(max_size=20)
|
| 810 |
+
except TypeError:
|
| 811 |
+
try:
|
| 812 |
+
# روش ۲: برای نسخههای قدیمیتر
|
| 813 |
+
demo.queue(concurrency_count=5, max_size=20)
|
| 814 |
+
except:
|
| 815 |
+
# روش ۳: بدون پارامتر
|
| 816 |
+
demo.queue()
|
| 817 |
+
|
| 818 |
demo.launch(
|
| 819 |
share=True,
|
| 820 |
+
server_name="0.0.0.0",
|
| 821 |
server_port=7860,
|
| 822 |
show_error=True
|
| 823 |
)
|