Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,7 @@ CODE_MODELS = {
|
|
| 109 |
}
|
| 110 |
|
| 111 |
# =========================================================
|
| 112 |
-
# DATABASE
|
| 113 |
# =========================================================
|
| 114 |
|
| 115 |
db_lock = threading.RLock()
|
|
@@ -378,46 +378,16 @@ def generate_image_to_image(input_image, prompt, negative_prompt, model_name, st
|
|
| 378 |
raise gr.Error(f"Image-to-image failed: {error}")
|
| 379 |
|
| 380 |
# =========================================================
|
| 381 |
-
# SYSTEM PROMPT
|
| 382 |
# =========================================================
|
| 383 |
|
| 384 |
SYSTEM_PROMPT = """
|
| 385 |
You are ARISE AI, a professional software engineering assistant.
|
| 386 |
-
|
| 387 |
-
You specialize in: Python, Kotlin, Java, Android, Gradle, AAPT2,
|
| 388 |
-
JavaScript, TypeScript, HTML, CSS, React, APIs, databases, Hugging Face,
|
| 389 |
-
Gradio, PyTorch, Diffusers, Transformers, debugging, software architecture
|
| 390 |
-
and code optimization.
|
| 391 |
-
|
| 392 |
-
RULES:
|
| 393 |
-
1. Understand the complete user request.
|
| 394 |
-
2. Generate practical working code.
|
| 395 |
-
3. Preserve existing features.
|
| 396 |
-
4. Never intentionally omit important code.
|
| 397 |
-
5. Analyze errors before proposing fixes.
|
| 398 |
-
6. Return complete files when requested.
|
| 399 |
-
7. Explain dependencies and limitations.
|
| 400 |
-
8. Never claim code was tested unless tested.
|
| 401 |
-
9. Use Markdown.
|
| 402 |
-
10. Avoid unnecessary changes.
|
| 403 |
-
11. Maintain environment compatibility.
|
| 404 |
-
12. Do not invent file contents that were not provided.
|
| 405 |
-
|
| 406 |
-
PROJECT FILE EDITING FORMAT:
|
| 407 |
-
When modifying project files, return every complete modified or new file
|
| 408 |
-
using exactly this format:
|
| 409 |
-
|
| 410 |
<<<FILE: relative/path/to/file.ext>>>
|
| 411 |
complete file content here
|
| 412 |
<<<END FILE>>>
|
| 413 |
-
|
| 414 |
-
Do not include unchanged files in this format.
|
| 415 |
-
Do not use absolute paths.
|
| 416 |
-
Do not use ../ path traversal.
|
| 417 |
-
Do not omit required imports or code.
|
| 418 |
-
Do not put explanatory text inside a file block.
|
| 419 |
-
|
| 420 |
-
When no file changes are needed, explain the answer normally.
|
| 421 |
"""
|
| 422 |
|
| 423 |
def load_code_model(model_name):
|
|
@@ -439,10 +409,6 @@ def load_code_model(model_name):
|
|
| 439 |
code_cache["model"] = model
|
| 440 |
return tokenizer, model
|
| 441 |
|
| 442 |
-
# =========================================================
|
| 443 |
-
# FILE HELPERS
|
| 444 |
-
# =========================================================
|
| 445 |
-
|
| 446 |
def safe_relative_path(value):
|
| 447 |
value = str(value).replace("\\", "/").strip()
|
| 448 |
path = Path(value)
|
|
@@ -577,7 +543,7 @@ class StopCriteria(StoppingCriteria):
|
|
| 577 |
return self.event.is_set()
|
| 578 |
|
| 579 |
# =========================================================
|
| 580 |
-
# CODING WORKER
|
| 581 |
# =========================================================
|
| 582 |
|
| 583 |
def run_coding_worker(job_id, session_id, conversation_id, prompt, model_name, max_tokens, temperature, stop_event):
|
|
@@ -640,11 +606,17 @@ def run_coding_worker(job_id, session_id, conversation_id, prompt, model_name, m
|
|
| 640 |
generation_thread.start()
|
| 641 |
|
| 642 |
response = ""
|
|
|
|
|
|
|
| 643 |
for token in streamer:
|
| 644 |
if stop_event.is_set():
|
| 645 |
break
|
| 646 |
response += token
|
| 647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
|
| 649 |
generation_thread.join(timeout=15)
|
| 650 |
if generation_thread.is_alive():
|
|
@@ -740,7 +712,7 @@ def coding_assistant(prompt, model_name, max_tokens, temperature, conversation_i
|
|
| 740 |
|
| 741 |
if status not in ["queued", "running"]:
|
| 742 |
return
|
| 743 |
-
time.sleep(
|
| 744 |
|
| 745 |
def resume_job(job_id, request: gr.Request):
|
| 746 |
session_id = request.session_hash if request else "default"
|
|
@@ -757,7 +729,7 @@ def resume_job(job_id, request: gr.Request):
|
|
| 757 |
yield (response, f"Job status: {status}", None, None)
|
| 758 |
if status not in ["queued", "running"]:
|
| 759 |
return
|
| 760 |
-
time.sleep(
|
| 761 |
|
| 762 |
def stop_job(job_id):
|
| 763 |
if not job_id:
|
|
@@ -808,7 +780,7 @@ def preview_project(conversation_id):
|
|
| 808 |
return make_html_preview(get_project_dir(conversation_id))
|
| 809 |
|
| 810 |
# =========================================================
|
| 811 |
-
# PREMIUM CSS β
|
| 812 |
# =========================================================
|
| 813 |
|
| 814 |
CSS = r"""
|
|
@@ -828,65 +800,17 @@ body, .gradio-container {
|
|
| 828 |
font-family: 'Space Grotesk', -apple-system, sans-serif !important;
|
| 829 |
}
|
| 830 |
|
|
|
|
| 831 |
body {
|
| 832 |
background:
|
| 833 |
-
radial-gradient(circle at 10% 10%, rgba(139,92,246,0.
|
| 834 |
-
radial-gradient(circle at 90% 20%, rgba(34,211,238,0.
|
| 835 |
-
radial-gradient(circle at 50% 90%, rgba(244,114,182,0.12), transparent 45%),
|
| 836 |
#06080f !important;
|
| 837 |
min-height: 100vh;
|
| 838 |
overflow-x: hidden;
|
| 839 |
position: relative;
|
| 840 |
}
|
| 841 |
|
| 842 |
-
/* === AURORA BACKGROUND === */
|
| 843 |
-
body::before {
|
| 844 |
-
content: '';
|
| 845 |
-
position: fixed;
|
| 846 |
-
top: -50%;
|
| 847 |
-
left: -50%;
|
| 848 |
-
width: 200%;
|
| 849 |
-
height: 200%;
|
| 850 |
-
background:
|
| 851 |
-
conic-gradient(from 0deg at 30% 40%, rgba(139,92,246,0.15), transparent 25%),
|
| 852 |
-
conic-gradient(from 120deg at 70% 60%, rgba(34,211,238,0.12), transparent 25%),
|
| 853 |
-
conic-gradient(from 240deg at 50% 30%, rgba(244,114,182,0.12), transparent 25%);
|
| 854 |
-
animation: auroraRotate 40s linear infinite;
|
| 855 |
-
pointer-events: none;
|
| 856 |
-
z-index: 0;
|
| 857 |
-
filter: blur(80px);
|
| 858 |
-
opacity: 0.7;
|
| 859 |
-
}
|
| 860 |
-
|
| 861 |
-
@keyframes auroraRotate {
|
| 862 |
-
from { transform: rotate(0deg); }
|
| 863 |
-
to { transform: rotate(360deg); }
|
| 864 |
-
}
|
| 865 |
-
|
| 866 |
-
/* === FLOATING PARTICLES === */
|
| 867 |
-
body::after {
|
| 868 |
-
content: '';
|
| 869 |
-
position: fixed;
|
| 870 |
-
inset: 0;
|
| 871 |
-
background-image:
|
| 872 |
-
radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
|
| 873 |
-
radial-gradient(1px 1px at 80% 70%, #8b5cf6, transparent),
|
| 874 |
-
radial-gradient(1.5px 1.5px at 40% 80%, #22d3ee, transparent),
|
| 875 |
-
radial-gradient(1px 1px at 60% 20%, #f472b6, transparent),
|
| 876 |
-
radial-gradient(1px 1px at 90% 40%, #fff, transparent),
|
| 877 |
-
radial-gradient(1.5px 1.5px at 10% 60%, #22d3ee, transparent);
|
| 878 |
-
background-size: 300px 300px, 400px 400px, 500px 500px, 350px 350px, 450px 450px, 550px 550px;
|
| 879 |
-
animation: starsFloat 60s linear infinite;
|
| 880 |
-
pointer-events: none;
|
| 881 |
-
z-index: 0;
|
| 882 |
-
opacity: 0.55;
|
| 883 |
-
}
|
| 884 |
-
|
| 885 |
-
@keyframes starsFloat {
|
| 886 |
-
from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
|
| 887 |
-
to { background-position: 300px 600px, -400px 400px, 500px -500px, -350px -350px, 450px 450px, -550px 550px; }
|
| 888 |
-
}
|
| 889 |
-
|
| 890 |
/* === CONTAINER === */
|
| 891 |
.gradio-container {
|
| 892 |
width: 100% !important;
|
|
@@ -896,12 +820,12 @@ body::after {
|
|
| 896 |
padding: 14px !important;
|
| 897 |
position: relative;
|
| 898 |
z-index: 1;
|
| 899 |
-
animation: fadeBoot
|
| 900 |
}
|
| 901 |
|
| 902 |
@keyframes fadeBoot {
|
| 903 |
-
from { opacity: 0;
|
| 904 |
-
to { opacity: 1;
|
| 905 |
}
|
| 906 |
|
| 907 |
/* === HEADER BANNER === */
|
|
@@ -912,42 +836,8 @@ body::after {
|
|
| 912 |
padding: 46px 20px;
|
| 913 |
border: 1px solid rgba(139,92,246,0.4);
|
| 914 |
border-radius: 26px;
|
| 915 |
-
background:
|
| 916 |
-
|
| 917 |
-
box-shadow:
|
| 918 |
-
0 0 40px rgba(139,92,246,0.25),
|
| 919 |
-
0 0 80px rgba(34,211,238,0.12),
|
| 920 |
-
inset 0 1px 0 rgba(255,255,255,0.08);
|
| 921 |
-
animation: bannerPulse 4s ease-in-out infinite alternate;
|
| 922 |
-
}
|
| 923 |
-
|
| 924 |
-
@keyframes bannerPulse {
|
| 925 |
-
from {
|
| 926 |
-
box-shadow: 0 0 30px rgba(139,92,246,0.2), 0 0 60px rgba(34,211,238,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
|
| 927 |
-
}
|
| 928 |
-
to {
|
| 929 |
-
box-shadow: 0 0 50px rgba(139,92,246,0.4), 0 0 100px rgba(34,211,238,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
|
| 930 |
-
}
|
| 931 |
-
}
|
| 932 |
-
|
| 933 |
-
#main-header::before {
|
| 934 |
-
content: '';
|
| 935 |
-
position: absolute;
|
| 936 |
-
inset: -2px;
|
| 937 |
-
border-radius: 26px;
|
| 938 |
-
padding: 2px;
|
| 939 |
-
background: linear-gradient(135deg, #8b5cf6, #22d3ee, #f472b6, #8b5cf6);
|
| 940 |
-
background-size: 300% 300%;
|
| 941 |
-
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
| 942 |
-
-webkit-mask-composite: xor;
|
| 943 |
-
mask-composite: exclude;
|
| 944 |
-
animation: borderFlow 6s linear infinite;
|
| 945 |
-
pointer-events: none;
|
| 946 |
-
}
|
| 947 |
-
|
| 948 |
-
@keyframes borderFlow {
|
| 949 |
-
0% { background-position: 0% 50%; }
|
| 950 |
-
100% { background-position: 300% 50%; }
|
| 951 |
}
|
| 952 |
|
| 953 |
.hero-title {
|
|
@@ -961,7 +851,6 @@ body::after {
|
|
| 961 |
-webkit-text-fill-color: transparent;
|
| 962 |
background-clip: text;
|
| 963 |
animation: heroShine 5s linear infinite;
|
| 964 |
-
text-shadow: 0 0 40px rgba(139,92,246,0.4);
|
| 965 |
}
|
| 966 |
|
| 967 |
@keyframes heroShine {
|
|
@@ -983,7 +872,6 @@ body::after {
|
|
| 983 |
align-items: center;
|
| 984 |
gap: 6px;
|
| 985 |
background: rgba(255,255,255,0.06);
|
| 986 |
-
backdrop-filter: blur(10px);
|
| 987 |
padding: 8px 16px;
|
| 988 |
border-radius: 30px;
|
| 989 |
color: #d8d5ff;
|
|
@@ -1006,21 +894,13 @@ body::after {
|
|
| 1006 |
border: 1px solid rgba(139,92,246,0.3) !important;
|
| 1007 |
border-radius: 18px !important;
|
| 1008 |
background: rgba(18,24,40,0.85) !important;
|
| 1009 |
-
backdrop-filter: blur(14px);
|
| 1010 |
padding: 8px !important;
|
| 1011 |
-
box-shadow: 0 0 30px rgba(139,92,246,0.1);
|
| 1012 |
}
|
| 1013 |
|
| 1014 |
.gradio-container .tab-nav button {
|
| 1015 |
border-radius: 12px !important;
|
| 1016 |
-
transition: all 0.3s
|
| 1017 |
font-weight: 600 !important;
|
| 1018 |
-
letter-spacing: 0.3px;
|
| 1019 |
-
}
|
| 1020 |
-
|
| 1021 |
-
.gradio-container .tab-nav button:hover {
|
| 1022 |
-
background: rgba(139,92,246,0.15) !important;
|
| 1023 |
-
color: #b8a5ff !important;
|
| 1024 |
}
|
| 1025 |
|
| 1026 |
.gradio-container .tab-nav button.selected {
|
|
@@ -1032,34 +912,8 @@ body::after {
|
|
| 1032 |
/* === BUTTONS === */
|
| 1033 |
.gradio-container button {
|
| 1034 |
border-radius: 12px !important;
|
| 1035 |
-
transition: all 0.3s
|
| 1036 |
font-weight: 600 !important;
|
| 1037 |
-
position: relative;
|
| 1038 |
-
overflow: hidden;
|
| 1039 |
-
}
|
| 1040 |
-
|
| 1041 |
-
.gradio-container button::before {
|
| 1042 |
-
content: '';
|
| 1043 |
-
position: absolute;
|
| 1044 |
-
top: 50%;
|
| 1045 |
-
left: 50%;
|
| 1046 |
-
width: 0;
|
| 1047 |
-
height: 0;
|
| 1048 |
-
border-radius: 50%;
|
| 1049 |
-
background: rgba(255,255,255,0.3);
|
| 1050 |
-
transform: translate(-50%, -50%);
|
| 1051 |
-
transition: width 0.6s, height 0.6s;
|
| 1052 |
-
pointer-events: none;
|
| 1053 |
-
}
|
| 1054 |
-
|
| 1055 |
-
.gradio-container button:active::before {
|
| 1056 |
-
width: 300px;
|
| 1057 |
-
height: 300px;
|
| 1058 |
-
}
|
| 1059 |
-
|
| 1060 |
-
.gradio-container button:hover {
|
| 1061 |
-
transform: translateY(-2px);
|
| 1062 |
-
box-shadow: 0 8px 25px rgba(139,92,246,0.4);
|
| 1063 |
}
|
| 1064 |
|
| 1065 |
.primary {
|
|
@@ -1067,7 +921,6 @@ body::after {
|
|
| 1067 |
background-size: 200% 200% !important;
|
| 1068 |
color: white !important;
|
| 1069 |
font-weight: 700 !important;
|
| 1070 |
-
letter-spacing: 0.5px;
|
| 1071 |
animation: gradientShift 3s ease infinite;
|
| 1072 |
box-shadow: 0 4px 20px rgba(139,92,246,0.4) !important;
|
| 1073 |
}
|
|
@@ -1077,72 +930,35 @@ body::after {
|
|
| 1077 |
50% { background-position: 100% 50%; }
|
| 1078 |
}
|
| 1079 |
|
| 1080 |
-
.primary:hover {
|
| 1081 |
-
box-shadow: 0 8px 35px rgba(139,92,246,0.7), 0 0 60px rgba(34,211,238,0.3) !important;
|
| 1082 |
-
}
|
| 1083 |
-
|
| 1084 |
-
.stop-btn, button[variant="stop"] {
|
| 1085 |
-
background: linear-gradient(135deg, #dc2626, #f97316) !important;
|
| 1086 |
-
color: white !important;
|
| 1087 |
-
box-shadow: 0 4px 20px rgba(220,38,38,0.4) !important;
|
| 1088 |
-
}
|
| 1089 |
-
|
| 1090 |
-
.stop-btn:hover, button[variant="stop"]:hover {
|
| 1091 |
-
box-shadow: 0 8px 30px rgba(220,38,38,0.7) !important;
|
| 1092 |
-
}
|
| 1093 |
-
|
| 1094 |
/* === INPUTS === */
|
| 1095 |
-
textarea, input[type="text"], input[type="number"]
|
| 1096 |
border-radius: 14px !important;
|
| 1097 |
background: rgba(15,20,35,0.7) !important;
|
| 1098 |
border: 1px solid rgba(139,92,246,0.2) !important;
|
| 1099 |
-
transition:
|
| 1100 |
-
backdrop-filter: blur(10px);
|
| 1101 |
}
|
| 1102 |
|
| 1103 |
textarea:focus, input:focus {
|
| 1104 |
border-color: rgba(139,92,246,0.7) !important;
|
| 1105 |
-
box-shadow: 0 0 0 3px rgba(139,92,246,0.2)
|
| 1106 |
outline: none !important;
|
| 1107 |
}
|
| 1108 |
|
| 1109 |
-
/* === CODING OUTPUT
|
| 1110 |
#coding-output {
|
| 1111 |
min-height: 320px;
|
| 1112 |
padding: 22px;
|
| 1113 |
border: 1px solid rgba(34,211,238,0.3);
|
| 1114 |
border-radius: 18px;
|
| 1115 |
-
background:
|
| 1116 |
-
linear-gradient(135deg, rgba(9,15,28,0.92), rgba(18,15,40,0.92));
|
| 1117 |
-
backdrop-filter: blur(16px);
|
| 1118 |
overflow-wrap: anywhere;
|
| 1119 |
position: relative;
|
| 1120 |
-
box-shadow:
|
| 1121 |
-
0 0 30px rgba(34,211,238,0.15),
|
| 1122 |
-
inset 0 1px 0 rgba(255,255,255,0.05);
|
| 1123 |
-
transition: all 0.4s ease;
|
| 1124 |
font-family: 'JetBrains Mono', 'Space Grotesk', monospace;
|
| 1125 |
font-size: 14px;
|
| 1126 |
line-height: 1.7;
|
| 1127 |
}
|
| 1128 |
|
| 1129 |
-
#coding-output::before {
|
| 1130 |
-
content: '';
|
| 1131 |
-
position: absolute;
|
| 1132 |
-
top: 0;
|
| 1133 |
-
left: 0;
|
| 1134 |
-
right: 0;
|
| 1135 |
-
height: 2px;
|
| 1136 |
-
background: linear-gradient(90deg, transparent, #22d3ee, #8b5cf6, transparent);
|
| 1137 |
-
border-radius: 18px 18px 0 0;
|
| 1138 |
-
animation: scanline 3s ease-in-out infinite;
|
| 1139 |
-
}
|
| 1140 |
-
|
| 1141 |
-
@keyframes scanline {
|
| 1142 |
-
0%, 100% { opacity: 0.4; }
|
| 1143 |
-
50% { opacity: 1; box-shadow: 0 0 15px #22d3ee; }
|
| 1144 |
-
}
|
| 1145 |
-
|
| 1146 |
#coding-output pre {
|
| 1147 |
max-width: 100%;
|
| 1148 |
overflow-x: auto;
|
|
@@ -1152,13 +968,12 @@ textarea:focus, input:focus {
|
|
| 1152 |
border: 1px solid rgba(139,92,246,0.15);
|
| 1153 |
}
|
| 1154 |
|
| 1155 |
-
/* Blinking cursor
|
| 1156 |
#coding-output.streaming::after {
|
| 1157 |
content: 'β';
|
| 1158 |
color: #22d3ee;
|
| 1159 |
animation: cursorBlink 0.8s step-end infinite;
|
| 1160 |
margin-left: 2px;
|
| 1161 |
-
text-shadow: 0 0 10px #22d3ee;
|
| 1162 |
}
|
| 1163 |
|
| 1164 |
@keyframes cursorBlink {
|
|
@@ -1176,50 +991,14 @@ textarea:focus, input:focus {
|
|
| 1176 |
color: #a5f3fc;
|
| 1177 |
font-size: 12px;
|
| 1178 |
font-weight: 600;
|
| 1179 |
-
letter-spacing: 0.5px;
|
| 1180 |
-
animation: statusPulse 2s ease-in-out infinite;
|
| 1181 |
-
}
|
| 1182 |
-
|
| 1183 |
-
@keyframes statusPulse {
|
| 1184 |
-
0%, 100% { box-shadow: 0 0 10px rgba(34,211,238,0.3); }
|
| 1185 |
-
50% { box-shadow: 0 0 25px rgba(34,211,238,0.6); }
|
| 1186 |
}
|
| 1187 |
|
| 1188 |
/* === SCROLLBAR === */
|
| 1189 |
-
::-webkit-scrollbar {
|
| 1190 |
-
|
| 1191 |
-
height: 8px;
|
| 1192 |
-
}
|
| 1193 |
-
|
| 1194 |
-
::-webkit-scrollbar-track {
|
| 1195 |
-
background: rgba(255,255,255,0.03);
|
| 1196 |
-
border-radius: 10px;
|
| 1197 |
-
}
|
| 1198 |
-
|
| 1199 |
::-webkit-scrollbar-thumb {
|
| 1200 |
background: linear-gradient(180deg, #8b5cf6, #22d3ee);
|
| 1201 |
border-radius: 10px;
|
| 1202 |
-
box-shadow: 0 0 10px rgba(139,92,246,0.5);
|
| 1203 |
-
}
|
| 1204 |
-
|
| 1205 |
-
::-webkit-scrollbar-thumb:hover {
|
| 1206 |
-
background: linear-gradient(180deg, #a855f7, #67e8f9);
|
| 1207 |
-
}
|
| 1208 |
-
|
| 1209 |
-
/* === MENU PANEL === */
|
| 1210 |
-
#menu-panel {
|
| 1211 |
-
border: 1px solid rgba(139,92,246,0.4);
|
| 1212 |
-
background: rgba(16,22,39,0.92);
|
| 1213 |
-
backdrop-filter: blur(20px);
|
| 1214 |
-
border-radius: 16px;
|
| 1215 |
-
padding: 16px;
|
| 1216 |
-
box-shadow: 0 0 40px rgba(139,92,246,0.2);
|
| 1217 |
-
animation: menuSlide 0.4s ease-out;
|
| 1218 |
-
}
|
| 1219 |
-
|
| 1220 |
-
@keyframes menuSlide {
|
| 1221 |
-
from { opacity: 0; transform: translateY(-10px); }
|
| 1222 |
-
to { opacity: 1; transform: translateY(0); }
|
| 1223 |
}
|
| 1224 |
|
| 1225 |
/* === FOOTER === */
|
|
@@ -1229,65 +1008,6 @@ textarea:focus, input:focus {
|
|
| 1229 |
padding: 30px 20px;
|
| 1230 |
border-top: 1px solid rgba(139,92,246,0.15);
|
| 1231 |
margin-top: 30px;
|
| 1232 |
-
position: relative;
|
| 1233 |
-
}
|
| 1234 |
-
|
| 1235 |
-
#footer::before {
|
| 1236 |
-
content: '';
|
| 1237 |
-
position: absolute;
|
| 1238 |
-
top: 0;
|
| 1239 |
-
left: 30%;
|
| 1240 |
-
right: 30%;
|
| 1241 |
-
height: 1px;
|
| 1242 |
-
background: linear-gradient(90deg, transparent, #8b5cf6, transparent);
|
| 1243 |
-
animation: footerGlow 3s ease-in-out infinite;
|
| 1244 |
-
}
|
| 1245 |
-
|
| 1246 |
-
@keyframes footerGlow {
|
| 1247 |
-
0%, 100% { opacity: 0.3; box-shadow: none; }
|
| 1248 |
-
50% { opacity: 1; box-shadow: 0 0 15px #8b5cf6; }
|
| 1249 |
-
}
|
| 1250 |
-
|
| 1251 |
-
#footer a {
|
| 1252 |
-
color: #a5b4fc;
|
| 1253 |
-
text-decoration: none;
|
| 1254 |
-
transition: all 0.3s;
|
| 1255 |
-
}
|
| 1256 |
-
|
| 1257 |
-
#footer a:hover {
|
| 1258 |
-
color: #67e8f9;
|
| 1259 |
-
text-shadow: 0 0 15px #67e8f9;
|
| 1260 |
-
}
|
| 1261 |
-
|
| 1262 |
-
/* === CARD HOVER EFFECT for blocks === */
|
| 1263 |
-
.gradio-container .block {
|
| 1264 |
-
transition: all 0.3s ease;
|
| 1265 |
-
}
|
| 1266 |
-
|
| 1267 |
-
.gradio-container .block:hover {
|
| 1268 |
-
border-color: rgba(139,92,246,0.4) !important;
|
| 1269 |
-
}
|
| 1270 |
-
|
| 1271 |
-
/* === LOADING SPINNER === */
|
| 1272 |
-
.generating {
|
| 1273 |
-
position: relative;
|
| 1274 |
-
}
|
| 1275 |
-
|
| 1276 |
-
.generating::after {
|
| 1277 |
-
content: '';
|
| 1278 |
-
position: absolute;
|
| 1279 |
-
top: 12px;
|
| 1280 |
-
right: 12px;
|
| 1281 |
-
width: 16px;
|
| 1282 |
-
height: 16px;
|
| 1283 |
-
border: 2px solid rgba(34,211,238,0.3);
|
| 1284 |
-
border-top-color: #22d3ee;
|
| 1285 |
-
border-radius: 50%;
|
| 1286 |
-
animation: spin 0.8s linear infinite;
|
| 1287 |
-
}
|
| 1288 |
-
|
| 1289 |
-
@keyframes spin {
|
| 1290 |
-
to { transform: rotate(360deg); }
|
| 1291 |
}
|
| 1292 |
|
| 1293 |
/* === MOBILE === */
|
|
@@ -1296,82 +1016,34 @@ textarea:focus, input:focus {
|
|
| 1296 |
#main-header { padding: 28px 12px; border-radius: 18px; }
|
| 1297 |
.hero-title { font-size: 30px; letter-spacing: -1px; }
|
| 1298 |
.hero-subtitle { font-size: 10px; letter-spacing: 2px; }
|
| 1299 |
-
.gradio-container .tab-nav button {
|
| 1300 |
-
|
| 1301 |
-
padding: 8px 5px !important;
|
| 1302 |
-
}
|
| 1303 |
-
#coding-output {
|
| 1304 |
-
min-height: 240px;
|
| 1305 |
-
padding: 12px;
|
| 1306 |
-
font-size: 12px;
|
| 1307 |
-
}
|
| 1308 |
}
|
| 1309 |
"""
|
| 1310 |
|
| 1311 |
# =========================================================
|
| 1312 |
-
# PREMIUM JS
|
| 1313 |
# =========================================================
|
| 1314 |
|
| 1315 |
PREMIUM_JS = """
|
| 1316 |
() => {
|
| 1317 |
-
//
|
| 1318 |
const attachCursor = () => {
|
| 1319 |
const output = document.querySelector('#coding-output');
|
| 1320 |
-
if (!output) return;
|
| 1321 |
-
if (output.dataset.cursorAttached) return;
|
| 1322 |
output.dataset.cursorAttached = '1';
|
| 1323 |
|
| 1324 |
let streamTimer = null;
|
| 1325 |
const observer = new MutationObserver(() => {
|
| 1326 |
output.classList.add('streaming');
|
| 1327 |
clearTimeout(streamTimer);
|
| 1328 |
-
streamTimer = setTimeout(() =>
|
| 1329 |
-
output.classList.remove('streaming');
|
| 1330 |
-
}, 1200);
|
| 1331 |
-
});
|
| 1332 |
-
observer.observe(output, { childList: true, subtree: true, characterData: true });
|
| 1333 |
-
};
|
| 1334 |
-
|
| 1335 |
-
// Ripple effect on all buttons
|
| 1336 |
-
const attachRipple = () => {
|
| 1337 |
-
document.querySelectorAll('button').forEach((btn) => {
|
| 1338 |
-
if (btn.dataset.rippleAttached) return;
|
| 1339 |
-
btn.dataset.rippleAttached = '1';
|
| 1340 |
-
btn.style.position = 'relative';
|
| 1341 |
-
btn.style.overflow = 'hidden';
|
| 1342 |
-
});
|
| 1343 |
-
};
|
| 1344 |
-
|
| 1345 |
-
// Smooth auto-scroll for output
|
| 1346 |
-
const attachAutoScroll = () => {
|
| 1347 |
-
const output = document.querySelector('#coding-output');
|
| 1348 |
-
if (!output || output.dataset.scrollAttached) return;
|
| 1349 |
-
output.dataset.scrollAttached = '1';
|
| 1350 |
-
const observer = new MutationObserver(() => {
|
| 1351 |
-
const nearBottom = output.scrollHeight - output.scrollTop - output.clientHeight < 200;
|
| 1352 |
-
if (nearBottom) {
|
| 1353 |
-
output.scrollTop = output.scrollHeight;
|
| 1354 |
-
}
|
| 1355 |
});
|
| 1356 |
observer.observe(output, { childList: true, subtree: true, characterData: true });
|
| 1357 |
};
|
| 1358 |
|
| 1359 |
-
//
|
| 1360 |
-
|
| 1361 |
-
attachRipple();
|
| 1362 |
-
attachAutoScroll();
|
| 1363 |
-
|
| 1364 |
-
// Re-apply on Gradio re-renders
|
| 1365 |
-
const globalObserver = new MutationObserver(() => {
|
| 1366 |
-
attachCursor();
|
| 1367 |
-
attachRipple();
|
| 1368 |
-
attachAutoScroll();
|
| 1369 |
-
});
|
| 1370 |
-
globalObserver.observe(document.body, { childList: true, subtree: true });
|
| 1371 |
-
|
| 1372 |
-
// Console signature
|
| 1373 |
-
console.log('%cβ‘ ARISE AI STUDIO', 'color:#8b5cf6;font-size:20px;font-weight:bold;text-shadow:0 0 10px #8b5cf6;');
|
| 1374 |
-
console.log('%cPremium AI Workspace Loaded', 'color:#22d3ee;font-size:12px;');
|
| 1375 |
}
|
| 1376 |
"""
|
| 1377 |
|
|
@@ -1381,34 +1053,15 @@ PREMIUM_JS = """
|
|
| 1381 |
|
| 1382 |
HEADER = """
|
| 1383 |
<div id="main-header">
|
| 1384 |
-
<div style="
|
| 1385 |
-
font-size: 12px;
|
| 1386 |
-
color: #83eaff;
|
| 1387 |
-
letter-spacing: 4px;
|
| 1388 |
-
font-weight: 800;
|
| 1389 |
-
margin-bottom: 14px;
|
| 1390 |
-
text-shadow: 0 0 20px #22d3ee;
|
| 1391 |
-
">
|
| 1392 |
β¦ NEXT GENERATION ARTIFICIAL INTELLIGENCE β¦
|
| 1393 |
</div>
|
| 1394 |
-
|
| 1395 |
<div class="hero-title">β‘ ARISE AI STUDIO</div>
|
| 1396 |
-
|
| 1397 |
-
<div class="hero-
|
| 1398 |
-
CREATE Β· TRANSFORM Β· CODE Β· INNOVATE
|
| 1399 |
-
</div>
|
| 1400 |
-
|
| 1401 |
-
<div class="hero-badges" style="
|
| 1402 |
-
display: flex;
|
| 1403 |
-
justify-content: center;
|
| 1404 |
-
flex-wrap: wrap;
|
| 1405 |
-
gap: 10px;
|
| 1406 |
-
margin-top: 24px;
|
| 1407 |
-
">
|
| 1408 |
<span>π¨ AI Art</span>
|
| 1409 |
<span>πΌ Image Transform</span>
|
| 1410 |
<span>π» AI Coding</span>
|
| 1411 |
-
<span>β‘ Live Stream</span>
|
| 1412 |
</div>
|
| 1413 |
</div>
|
| 1414 |
"""
|
|
@@ -1435,40 +1088,20 @@ with gr.Blocks(title=APP_NAME) as demo:
|
|
| 1435 |
|
| 1436 |
menu_button.click(lambda: gr.update(visible=True), outputs=menu_panel)
|
| 1437 |
|
| 1438 |
-
gr.Markdown("""
|
| 1439 |
-
<div style="text-align:center;color:#9ba9c5;padding:12px;font-size:13px;letter-spacing:1px">
|
| 1440 |
-
β¦ PREMIUM AI WORKSPACE Β· OPEN MODELS Β· LIVE GENERATION β¦
|
| 1441 |
-
</div>
|
| 1442 |
-
""")
|
| 1443 |
-
|
| 1444 |
with gr.Tabs():
|
| 1445 |
|
| 1446 |
# --- TEXT TO IMAGE ---
|
| 1447 |
with gr.Tab("π¨ Text to Image"):
|
| 1448 |
-
gr.
|
| 1449 |
-
|
| 1450 |
-
image_model = gr.Dropdown(
|
| 1451 |
-
choices=list(IMAGE_MODELS.keys()),
|
| 1452 |
-
value="SDXL Turbo",
|
| 1453 |
-
label="Select Image Model",
|
| 1454 |
-
)
|
| 1455 |
-
image_prompt = gr.Textbox(
|
| 1456 |
-
label="Image Prompt",
|
| 1457 |
-
placeholder="Describe your image in detail...",
|
| 1458 |
-
lines=4,
|
| 1459 |
-
)
|
| 1460 |
negative_prompt = gr.Textbox(label="Negative Prompt", lines=2)
|
| 1461 |
-
|
| 1462 |
with gr.Row():
|
| 1463 |
width = gr.Slider(256, 768, value=512, step=64, label="Image Width")
|
| 1464 |
height = gr.Slider(256, 768, value=512, step=64, label="Image Height")
|
| 1465 |
-
|
| 1466 |
steps = gr.Slider(1, 30, value=4, step=1, label="Inference Steps")
|
| 1467 |
-
|
| 1468 |
with gr.Row():
|
| 1469 |
seed = gr.Number(value=0, precision=0, label="Seed")
|
| 1470 |
random_seed = gr.Checkbox(value=True, label="Random Seed")
|
| 1471 |
-
|
| 1472 |
generate_button = gr.Button("β¨ Generate Image", variant="primary")
|
| 1473 |
image_output = gr.Image(label="Generated Artwork", type="pil", height=400)
|
| 1474 |
seed_output = gr.Number(label="Used Seed", precision=0)
|
|
@@ -1481,27 +1114,17 @@ with gr.Blocks(title=APP_NAME) as demo:
|
|
| 1481 |
|
| 1482 |
# --- IMAGE TO IMAGE ---
|
| 1483 |
with gr.Tab("πΌ Image to Image"):
|
| 1484 |
-
gr.Markdown("## πΌ Transform Your Images")
|
| 1485 |
-
|
| 1486 |
input_image = gr.Image(label="Upload Original Image", type="pil", height=300)
|
| 1487 |
-
img2img_model = gr.Dropdown(
|
| 1488 |
-
|
| 1489 |
-
value="Stable Diffusion 1.5 Img2Img",
|
| 1490 |
-
label="Image-to-Image Model",
|
| 1491 |
-
)
|
| 1492 |
-
img2img_prompt = gr.Textbox(label="Transformation Prompt",
|
| 1493 |
-
placeholder="Describe the new image style...", lines=4)
|
| 1494 |
img2img_negative = gr.Textbox(label="Negative Prompt", lines=2)
|
| 1495 |
strength = gr.Slider(0.05, 0.95, value=0.70, step=0.05, label="Transformation Strength")
|
| 1496 |
-
|
| 1497 |
with gr.Row():
|
| 1498 |
img2img_steps = gr.Slider(1, 30, value=25, step=1, label="Inference Steps")
|
| 1499 |
img2img_guidance = gr.Slider(1, 15, value=7.5, step=0.5, label="Guidance Scale")
|
| 1500 |
-
|
| 1501 |
with gr.Row():
|
| 1502 |
img2img_seed = gr.Number(value=0, precision=0, label="Seed")
|
| 1503 |
img2img_random = gr.Checkbox(value=True, label="Random Seed")
|
| 1504 |
-
|
| 1505 |
img2img_button = gr.Button("πͺ Transform Image", variant="primary")
|
| 1506 |
img2img_output = gr.Image(label="Transformed Image", type="pil", height=400)
|
| 1507 |
img2img_seed_output = gr.Number(label="Used Seed", precision=0)
|
|
@@ -1515,134 +1138,75 @@ with gr.Blocks(title=APP_NAME) as demo:
|
|
| 1515 |
|
| 1516 |
# --- AI CODING ---
|
| 1517 |
with gr.Tab("π» AI Coding"):
|
| 1518 |
-
gr.Markdown(""
|
| 1519 |
-
|
| 1520 |
-
|
| 1521 |
-
""")
|
| 1522 |
-
|
| 1523 |
-
code_model = gr.Dropdown(
|
| 1524 |
-
choices=list(CODE_MODELS.keys()),
|
| 1525 |
-
value="Qwen Coder 0.5B",
|
| 1526 |
-
label="Select Coding Model",
|
| 1527 |
-
)
|
| 1528 |
-
|
| 1529 |
-
# Note: Upload option removed as requested
|
| 1530 |
-
code_prompt = gr.Textbox(
|
| 1531 |
-
label="Your Coding Request",
|
| 1532 |
-
placeholder="Example: Change the app theme and update the home screen...",
|
| 1533 |
-
lines=5,
|
| 1534 |
-
)
|
| 1535 |
-
|
| 1536 |
with gr.Row():
|
| 1537 |
max_tokens = gr.Slider(128, 2048, value=768, step=128, label="Maximum Output Tokens")
|
| 1538 |
temperature = gr.Slider(0.1, 1.0, value=0.3, step=0.1, label="Temperature")
|
| 1539 |
-
|
| 1540 |
-
coding_output = gr.Markdown(
|
| 1541 |
-
|
| 1542 |
-
elem_id="coding-output",
|
| 1543 |
-
)
|
| 1544 |
-
|
| 1545 |
with gr.Row():
|
| 1546 |
generate_code = gr.Button("β‘ Start Coding", variant="primary")
|
| 1547 |
stop_button = gr.Button("βΉ Stop", variant="stop")
|
| 1548 |
new_project_button = gr.Button("οΌ New Project", variant="secondary")
|
| 1549 |
-
|
| 1550 |
coding_status = gr.Markdown("Ready.", elem_id="coding-status")
|
| 1551 |
-
|
| 1552 |
gr.Markdown("### π¦ Project Downloads")
|
| 1553 |
-
|
| 1554 |
with gr.Row():
|
| 1555 |
project_zip_download = gr.File(label="Download Full Project ZIP", interactive=False)
|
| 1556 |
single_file_download = gr.File(label="Download Last Edited File", interactive=False)
|
| 1557 |
-
|
| 1558 |
preview_button = gr.Button("π Preview HTML Project")
|
| 1559 |
-
html_preview = gr.HTML(
|
| 1560 |
-
value="<div style='padding:15px;color:#aaa'>HTML preview will appear here.</div>"
|
| 1561 |
-
)
|
| 1562 |
|
| 1563 |
-
# Updated inputs: removed 'project_upload'
|
| 1564 |
generate_code.click(
|
| 1565 |
fn=coding_assistant,
|
| 1566 |
inputs=[code_prompt, code_model, max_tokens, temperature, conversation_state],
|
| 1567 |
-
outputs=[coding_output, conversation_state, coding_status,
|
| 1568 |
-
project_zip_download, single_file_download, job_state],
|
| 1569 |
)
|
| 1570 |
stop_button.click(fn=stop_job, inputs=job_state, outputs=coding_status)
|
| 1571 |
-
new_project_button.click(
|
| 1572 |
-
fn=clear_current_conversation,
|
| 1573 |
-
outputs=[coding_output, conversation_state, coding_status, job_state],
|
| 1574 |
-
)
|
| 1575 |
preview_button.click(fn=preview_project, inputs=conversation_state, outputs=html_preview)
|
| 1576 |
|
| 1577 |
# --- HISTORY ---
|
| 1578 |
with gr.Tab("π History"):
|
| 1579 |
-
gr.Markdown("## π Saved Conversations and Projects")
|
| 1580 |
-
|
| 1581 |
history_dropdown = gr.Dropdown(choices=[], label="Saved History", interactive=True)
|
| 1582 |
-
|
| 1583 |
with gr.Row():
|
| 1584 |
refresh_history_button = gr.Button("π Refresh History")
|
| 1585 |
load_history_button = gr.Button("π Open Selected", variant="primary")
|
| 1586 |
-
|
| 1587 |
history_output = gr.Markdown("Select a saved conversation.")
|
| 1588 |
history_status = gr.Markdown("")
|
| 1589 |
resume_button = gr.Button("βΆ Resume Selected Job")
|
| 1590 |
-
|
| 1591 |
with gr.Row():
|
| 1592 |
delete_history_button = gr.Button("π Delete Selected", variant="stop")
|
| 1593 |
delete_all_history_button = gr.Button("π Delete All", variant="stop")
|
| 1594 |
|
| 1595 |
refresh_history_button.click(fn=refresh_history, outputs=history_dropdown)
|
| 1596 |
-
load_history_button.click(
|
| 1597 |
-
|
| 1598 |
-
inputs=history_dropdown,
|
| 1599 |
-
outputs=[history_output, conversation_state, history_status, job_state],
|
| 1600 |
-
)
|
| 1601 |
-
delete_history_button.click(
|
| 1602 |
-
fn=delete_selected_history,
|
| 1603 |
-
inputs=history_dropdown,
|
| 1604 |
-
outputs=[history_dropdown, history_status],
|
| 1605 |
-
)
|
| 1606 |
|
| 1607 |
def delete_all(request: gr.Request):
|
| 1608 |
session_id = request.session_hash if request else "default"
|
| 1609 |
-
|
| 1610 |
-
ids = [value for _, value in choices]
|
| 1611 |
delete_conversations(session_id, ids)
|
| 1612 |
return (gr.Dropdown(choices=[], value=None), "All history deleted.")
|
| 1613 |
|
| 1614 |
-
delete_all_history_button.click(
|
| 1615 |
-
|
| 1616 |
-
outputs=[history_dropdown, history_status],
|
| 1617 |
-
)
|
| 1618 |
-
resume_button.click(
|
| 1619 |
-
fn=resume_job,
|
| 1620 |
-
inputs=job_state,
|
| 1621 |
-
outputs=[history_output, history_status, project_zip_download, single_file_download],
|
| 1622 |
-
)
|
| 1623 |
|
| 1624 |
-
# --- FOOTER ---
|
| 1625 |
gr.HTML(f"""
|
| 1626 |
<div id="footer">
|
| 1627 |
-
<div style="font-size:22px;font-weight:800;
|
| 1628 |
-
background:linear-gradient(90deg,#c7b7ff,#67e8f9);
|
| 1629 |
-
-webkit-background-clip:text;-webkit-text-fill-color:transparent;
|
| 1630 |
-
margin-bottom:8px;">
|
| 1631 |
β‘ ARISE AI STUDIO
|
| 1632 |
</div>
|
| 1633 |
-
<div style="color:#a5b4fc;font-size:13px;
|
| 1634 |
-
|
| 1635 |
-
</div>
|
| 1636 |
-
<div style="margin-top:10px;font-size:12px">
|
| 1637 |
-
Developer: <a href="{DEVELOPER_TELEGRAM}" target="_blank">@hardhackar009</a>
|
| 1638 |
-
</div>
|
| 1639 |
-
<div style="margin-top:8px;font-size:11px;color:#64748b">
|
| 1640 |
-
Powered by Open Source Models and Hugging Face
|
| 1641 |
-
</div>
|
| 1642 |
</div>
|
| 1643 |
""")
|
| 1644 |
|
| 1645 |
-
# Attach premium JS on load
|
| 1646 |
demo.load(fn=None, js=PREMIUM_JS)
|
| 1647 |
|
| 1648 |
# =========================================================
|
|
@@ -1650,17 +1214,10 @@ with gr.Blocks(title=APP_NAME) as demo:
|
|
| 1650 |
# =========================================================
|
| 1651 |
|
| 1652 |
if __name__ == "__main__":
|
| 1653 |
-
demo.queue(
|
| 1654 |
-
|
| 1655 |
-
max_size=20,
|
| 1656 |
-
).launch(
|
| 1657 |
-
theme=gr.themes.Soft(
|
| 1658 |
-
primary_hue="violet",
|
| 1659 |
-
secondary_hue="cyan",
|
| 1660 |
-
neutral_hue="slate",
|
| 1661 |
-
),
|
| 1662 |
css=CSS,
|
| 1663 |
-
allowed_paths=[str(DATA_DIR.resolve())],
|
| 1664 |
show_error=True,
|
| 1665 |
share=False,
|
| 1666 |
)
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
# =========================================================
|
| 112 |
+
# DATABASE (Optimized)
|
| 113 |
# =========================================================
|
| 114 |
|
| 115 |
db_lock = threading.RLock()
|
|
|
|
| 378 |
raise gr.Error(f"Image-to-image failed: {error}")
|
| 379 |
|
| 380 |
# =========================================================
|
| 381 |
+
# SYSTEM PROMPT & FILE HELPERS
|
| 382 |
# =========================================================
|
| 383 |
|
| 384 |
SYSTEM_PROMPT = """
|
| 385 |
You are ARISE AI, a professional software engineering assistant.
|
| 386 |
+
When modifying project files, return every complete modified or new file using exactly this format:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
<<<FILE: relative/path/to/file.ext>>>
|
| 388 |
complete file content here
|
| 389 |
<<<END FILE>>>
|
| 390 |
+
Do not use absolute paths. Do not omit required imports or code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
"""
|
| 392 |
|
| 393 |
def load_code_model(model_name):
|
|
|
|
| 409 |
code_cache["model"] = model
|
| 410 |
return tokenizer, model
|
| 411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
def safe_relative_path(value):
|
| 413 |
value = str(value).replace("\\", "/").strip()
|
| 414 |
path = Path(value)
|
|
|
|
| 543 |
return self.event.is_set()
|
| 544 |
|
| 545 |
# =========================================================
|
| 546 |
+
# CODING WORKER (Throttled for smooth streaming)
|
| 547 |
# =========================================================
|
| 548 |
|
| 549 |
def run_coding_worker(job_id, session_id, conversation_id, prompt, model_name, max_tokens, temperature, stop_event):
|
|
|
|
| 606 |
generation_thread.start()
|
| 607 |
|
| 608 |
response = ""
|
| 609 |
+
last_db_update = time.time()
|
| 610 |
+
|
| 611 |
for token in streamer:
|
| 612 |
if stop_event.is_set():
|
| 613 |
break
|
| 614 |
response += token
|
| 615 |
+
|
| 616 |
+
# π₯ LAG FIX: Update database only every 0.2 seconds instead of every token
|
| 617 |
+
if time.time() - last_db_update > 0.2:
|
| 618 |
+
update_job(job_id, response=response, status="running")
|
| 619 |
+
last_db_update = time.time()
|
| 620 |
|
| 621 |
generation_thread.join(timeout=15)
|
| 622 |
if generation_thread.is_alive():
|
|
|
|
| 712 |
|
| 713 |
if status not in ["queued", "running"]:
|
| 714 |
return
|
| 715 |
+
time.sleep(0.5) # π₯ Faster UI polling
|
| 716 |
|
| 717 |
def resume_job(job_id, request: gr.Request):
|
| 718 |
session_id = request.session_hash if request else "default"
|
|
|
|
| 729 |
yield (response, f"Job status: {status}", None, None)
|
| 730 |
if status not in ["queued", "running"]:
|
| 731 |
return
|
| 732 |
+
time.sleep(1.5)
|
| 733 |
|
| 734 |
def stop_job(job_id):
|
| 735 |
if not job_id:
|
|
|
|
| 780 |
return make_html_preview(get_project_dir(conversation_id))
|
| 781 |
|
| 782 |
# =========================================================
|
| 783 |
+
# PREMIUM CSS β Optimized for Smooth Performance
|
| 784 |
# =========================================================
|
| 785 |
|
| 786 |
CSS = r"""
|
|
|
|
| 800 |
font-family: 'Space Grotesk', -apple-system, sans-serif !important;
|
| 801 |
}
|
| 802 |
|
| 803 |
+
/* π₯ LAG FIX: Lighter background gradient */
|
| 804 |
body {
|
| 805 |
background:
|
| 806 |
+
radial-gradient(circle at 10% 10%, rgba(139,92,246,0.12), transparent 40%),
|
| 807 |
+
radial-gradient(circle at 90% 20%, rgba(34,211,238,0.08), transparent 40%),
|
|
|
|
| 808 |
#06080f !important;
|
| 809 |
min-height: 100vh;
|
| 810 |
overflow-x: hidden;
|
| 811 |
position: relative;
|
| 812 |
}
|
| 813 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 814 |
/* === CONTAINER === */
|
| 815 |
.gradio-container {
|
| 816 |
width: 100% !important;
|
|
|
|
| 820 |
padding: 14px !important;
|
| 821 |
position: relative;
|
| 822 |
z-index: 1;
|
| 823 |
+
animation: fadeBoot 0.5s ease-out;
|
| 824 |
}
|
| 825 |
|
| 826 |
@keyframes fadeBoot {
|
| 827 |
+
from { opacity: 0; }
|
| 828 |
+
to { opacity: 1; }
|
| 829 |
}
|
| 830 |
|
| 831 |
/* === HEADER BANNER === */
|
|
|
|
| 836 |
padding: 46px 20px;
|
| 837 |
border: 1px solid rgba(139,92,246,0.4);
|
| 838 |
border-radius: 26px;
|
| 839 |
+
background: linear-gradient(135deg, rgba(45,26,90,0.95) 0%, rgba(9,35,57,0.95) 50%, rgba(30,17,70,0.95) 100%);
|
| 840 |
+
box-shadow: 0 0 40px rgba(139,92,246,0.25);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 841 |
}
|
| 842 |
|
| 843 |
.hero-title {
|
|
|
|
| 851 |
-webkit-text-fill-color: transparent;
|
| 852 |
background-clip: text;
|
| 853 |
animation: heroShine 5s linear infinite;
|
|
|
|
| 854 |
}
|
| 855 |
|
| 856 |
@keyframes heroShine {
|
|
|
|
| 872 |
align-items: center;
|
| 873 |
gap: 6px;
|
| 874 |
background: rgba(255,255,255,0.06);
|
|
|
|
| 875 |
padding: 8px 16px;
|
| 876 |
border-radius: 30px;
|
| 877 |
color: #d8d5ff;
|
|
|
|
| 894 |
border: 1px solid rgba(139,92,246,0.3) !important;
|
| 895 |
border-radius: 18px !important;
|
| 896 |
background: rgba(18,24,40,0.85) !important;
|
|
|
|
| 897 |
padding: 8px !important;
|
|
|
|
| 898 |
}
|
| 899 |
|
| 900 |
.gradio-container .tab-nav button {
|
| 901 |
border-radius: 12px !important;
|
| 902 |
+
transition: all 0.3s ease !important;
|
| 903 |
font-weight: 600 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
}
|
| 905 |
|
| 906 |
.gradio-container .tab-nav button.selected {
|
|
|
|
| 912 |
/* === BUTTONS === */
|
| 913 |
.gradio-container button {
|
| 914 |
border-radius: 12px !important;
|
| 915 |
+
transition: all 0.3s ease !important;
|
| 916 |
font-weight: 600 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 917 |
}
|
| 918 |
|
| 919 |
.primary {
|
|
|
|
| 921 |
background-size: 200% 200% !important;
|
| 922 |
color: white !important;
|
| 923 |
font-weight: 700 !important;
|
|
|
|
| 924 |
animation: gradientShift 3s ease infinite;
|
| 925 |
box-shadow: 0 4px 20px rgba(139,92,246,0.4) !important;
|
| 926 |
}
|
|
|
|
| 930 |
50% { background-position: 100% 50%; }
|
| 931 |
}
|
| 932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 933 |
/* === INPUTS === */
|
| 934 |
+
textarea, input[type="text"], input[type="number"] {
|
| 935 |
border-radius: 14px !important;
|
| 936 |
background: rgba(15,20,35,0.7) !important;
|
| 937 |
border: 1px solid rgba(139,92,246,0.2) !important;
|
| 938 |
+
transition: border-color 0.3s ease !important;
|
|
|
|
| 939 |
}
|
| 940 |
|
| 941 |
textarea:focus, input:focus {
|
| 942 |
border-color: rgba(139,92,246,0.7) !important;
|
| 943 |
+
box-shadow: 0 0 0 3px rgba(139,92,246,0.2) !important;
|
| 944 |
outline: none !important;
|
| 945 |
}
|
| 946 |
|
| 947 |
+
/* === CODING OUTPUT === */
|
| 948 |
#coding-output {
|
| 949 |
min-height: 320px;
|
| 950 |
padding: 22px;
|
| 951 |
border: 1px solid rgba(34,211,238,0.3);
|
| 952 |
border-radius: 18px;
|
| 953 |
+
background: linear-gradient(135deg, rgba(9,15,28,0.92), rgba(18,15,40,0.92));
|
|
|
|
|
|
|
| 954 |
overflow-wrap: anywhere;
|
| 955 |
position: relative;
|
| 956 |
+
box-shadow: 0 0 30px rgba(34,211,238,0.15);
|
|
|
|
|
|
|
|
|
|
| 957 |
font-family: 'JetBrains Mono', 'Space Grotesk', monospace;
|
| 958 |
font-size: 14px;
|
| 959 |
line-height: 1.7;
|
| 960 |
}
|
| 961 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 962 |
#coding-output pre {
|
| 963 |
max-width: 100%;
|
| 964 |
overflow-x: auto;
|
|
|
|
| 968 |
border: 1px solid rgba(139,92,246,0.15);
|
| 969 |
}
|
| 970 |
|
| 971 |
+
/* Blinking cursor */
|
| 972 |
#coding-output.streaming::after {
|
| 973 |
content: 'β';
|
| 974 |
color: #22d3ee;
|
| 975 |
animation: cursorBlink 0.8s step-end infinite;
|
| 976 |
margin-left: 2px;
|
|
|
|
| 977 |
}
|
| 978 |
|
| 979 |
@keyframes cursorBlink {
|
|
|
|
| 991 |
color: #a5f3fc;
|
| 992 |
font-size: 12px;
|
| 993 |
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 994 |
}
|
| 995 |
|
| 996 |
/* === SCROLLBAR === */
|
| 997 |
+
::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 998 |
+
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 10px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 999 |
::-webkit-scrollbar-thumb {
|
| 1000 |
background: linear-gradient(180deg, #8b5cf6, #22d3ee);
|
| 1001 |
border-radius: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1002 |
}
|
| 1003 |
|
| 1004 |
/* === FOOTER === */
|
|
|
|
| 1008 |
padding: 30px 20px;
|
| 1009 |
border-top: 1px solid rgba(139,92,246,0.15);
|
| 1010 |
margin-top: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1011 |
}
|
| 1012 |
|
| 1013 |
/* === MOBILE === */
|
|
|
|
| 1016 |
#main-header { padding: 28px 12px; border-radius: 18px; }
|
| 1017 |
.hero-title { font-size: 30px; letter-spacing: -1px; }
|
| 1018 |
.hero-subtitle { font-size: 10px; letter-spacing: 2px; }
|
| 1019 |
+
.gradio-container .tab-nav button { font-size: 11px !important; padding: 8px 5px !important; }
|
| 1020 |
+
#coding-output { min-height: 240px; padding: 12px; font-size: 12px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1021 |
}
|
| 1022 |
"""
|
| 1023 |
|
| 1024 |
# =========================================================
|
| 1025 |
+
# PREMIUM JS (Lightweight & Smooth)
|
| 1026 |
# =========================================================
|
| 1027 |
|
| 1028 |
PREMIUM_JS = """
|
| 1029 |
() => {
|
| 1030 |
+
// Cursor effect on streaming output only
|
| 1031 |
const attachCursor = () => {
|
| 1032 |
const output = document.querySelector('#coding-output');
|
| 1033 |
+
if (!output || output.dataset.cursorAttached) return;
|
|
|
|
| 1034 |
output.dataset.cursorAttached = '1';
|
| 1035 |
|
| 1036 |
let streamTimer = null;
|
| 1037 |
const observer = new MutationObserver(() => {
|
| 1038 |
output.classList.add('streaming');
|
| 1039 |
clearTimeout(streamTimer);
|
| 1040 |
+
streamTimer = setTimeout(() => output.classList.remove('streaming'), 1200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1041 |
});
|
| 1042 |
observer.observe(output, { childList: true, subtree: true, characterData: true });
|
| 1043 |
};
|
| 1044 |
|
| 1045 |
+
// Run once on load
|
| 1046 |
+
setTimeout(attachCursor, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1047 |
}
|
| 1048 |
"""
|
| 1049 |
|
|
|
|
| 1053 |
|
| 1054 |
HEADER = """
|
| 1055 |
<div id="main-header">
|
| 1056 |
+
<div style="font-size: 12px; color: #83eaff; letter-spacing: 4px; font-weight: 800; margin-bottom: 14px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1057 |
β¦ NEXT GENERATION ARTIFICIAL INTELLIGENCE β¦
|
| 1058 |
</div>
|
|
|
|
| 1059 |
<div class="hero-title">β‘ ARISE AI STUDIO</div>
|
| 1060 |
+
<div class="hero-subtitle">CREATE Β· TRANSFORM Β· CODE Β· INNOVATE</div>
|
| 1061 |
+
<div class="hero-badges" style="display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1062 |
<span>π¨ AI Art</span>
|
| 1063 |
<span>πΌ Image Transform</span>
|
| 1064 |
<span>π» AI Coding</span>
|
|
|
|
| 1065 |
</div>
|
| 1066 |
</div>
|
| 1067 |
"""
|
|
|
|
| 1088 |
|
| 1089 |
menu_button.click(lambda: gr.update(visible=True), outputs=menu_panel)
|
| 1090 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1091 |
with gr.Tabs():
|
| 1092 |
|
| 1093 |
# --- TEXT TO IMAGE ---
|
| 1094 |
with gr.Tab("π¨ Text to Image"):
|
| 1095 |
+
image_model = gr.Dropdown(choices=list(IMAGE_MODELS.keys()), value="SDXL Turbo", label="Select Image Model")
|
| 1096 |
+
image_prompt = gr.Textbox(label="Image Prompt", placeholder="Describe your image in detail...", lines=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1097 |
negative_prompt = gr.Textbox(label="Negative Prompt", lines=2)
|
|
|
|
| 1098 |
with gr.Row():
|
| 1099 |
width = gr.Slider(256, 768, value=512, step=64, label="Image Width")
|
| 1100 |
height = gr.Slider(256, 768, value=512, step=64, label="Image Height")
|
|
|
|
| 1101 |
steps = gr.Slider(1, 30, value=4, step=1, label="Inference Steps")
|
|
|
|
| 1102 |
with gr.Row():
|
| 1103 |
seed = gr.Number(value=0, precision=0, label="Seed")
|
| 1104 |
random_seed = gr.Checkbox(value=True, label="Random Seed")
|
|
|
|
| 1105 |
generate_button = gr.Button("β¨ Generate Image", variant="primary")
|
| 1106 |
image_output = gr.Image(label="Generated Artwork", type="pil", height=400)
|
| 1107 |
seed_output = gr.Number(label="Used Seed", precision=0)
|
|
|
|
| 1114 |
|
| 1115 |
# --- IMAGE TO IMAGE ---
|
| 1116 |
with gr.Tab("πΌ Image to Image"):
|
|
|
|
|
|
|
| 1117 |
input_image = gr.Image(label="Upload Original Image", type="pil", height=300)
|
| 1118 |
+
img2img_model = gr.Dropdown(choices=list(IMAGE_TO_IMAGE_MODELS.keys()), value="Stable Diffusion 1.5 Img2Img", label="Image-to-Image Model")
|
| 1119 |
+
img2img_prompt = gr.Textbox(label="Transformation Prompt", placeholder="Describe the new image style...", lines=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1120 |
img2img_negative = gr.Textbox(label="Negative Prompt", lines=2)
|
| 1121 |
strength = gr.Slider(0.05, 0.95, value=0.70, step=0.05, label="Transformation Strength")
|
|
|
|
| 1122 |
with gr.Row():
|
| 1123 |
img2img_steps = gr.Slider(1, 30, value=25, step=1, label="Inference Steps")
|
| 1124 |
img2img_guidance = gr.Slider(1, 15, value=7.5, step=0.5, label="Guidance Scale")
|
|
|
|
| 1125 |
with gr.Row():
|
| 1126 |
img2img_seed = gr.Number(value=0, precision=0, label="Seed")
|
| 1127 |
img2img_random = gr.Checkbox(value=True, label="Random Seed")
|
|
|
|
| 1128 |
img2img_button = gr.Button("πͺ Transform Image", variant="primary")
|
| 1129 |
img2img_output = gr.Image(label="Transformed Image", type="pil", height=400)
|
| 1130 |
img2img_seed_output = gr.Number(label="Used Seed", precision=0)
|
|
|
|
| 1138 |
|
| 1139 |
# --- AI CODING ---
|
| 1140 |
with gr.Tab("π» AI Coding"):
|
| 1141 |
+
gr.Markdown("## π» ARISE AI Coding Workspace")
|
| 1142 |
+
code_model = gr.Dropdown(choices=list(CODE_MODELS.keys()), value="Qwen Coder 0.5B", label="Select Coding Model")
|
| 1143 |
+
code_prompt = gr.Textbox(label="Your Coding Request", placeholder="Describe your changes...", lines=5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1144 |
with gr.Row():
|
| 1145 |
max_tokens = gr.Slider(128, 2048, value=768, step=128, label="Maximum Output Tokens")
|
| 1146 |
temperature = gr.Slider(0.1, 1.0, value=0.3, step=0.1, label="Temperature")
|
| 1147 |
+
|
| 1148 |
+
coding_output = gr.Markdown(value="Ready to work on your project.", elem_id="coding-output")
|
| 1149 |
+
|
|
|
|
|
|
|
|
|
|
| 1150 |
with gr.Row():
|
| 1151 |
generate_code = gr.Button("β‘ Start Coding", variant="primary")
|
| 1152 |
stop_button = gr.Button("βΉ Stop", variant="stop")
|
| 1153 |
new_project_button = gr.Button("οΌ New Project", variant="secondary")
|
| 1154 |
+
|
| 1155 |
coding_status = gr.Markdown("Ready.", elem_id="coding-status")
|
|
|
|
| 1156 |
gr.Markdown("### π¦ Project Downloads")
|
| 1157 |
+
|
| 1158 |
with gr.Row():
|
| 1159 |
project_zip_download = gr.File(label="Download Full Project ZIP", interactive=False)
|
| 1160 |
single_file_download = gr.File(label="Download Last Edited File", interactive=False)
|
| 1161 |
+
|
| 1162 |
preview_button = gr.Button("π Preview HTML Project")
|
| 1163 |
+
html_preview = gr.HTML(value="<div style='padding:15px;color:#aaa'>HTML preview will appear here.</div>")
|
|
|
|
|
|
|
| 1164 |
|
|
|
|
| 1165 |
generate_code.click(
|
| 1166 |
fn=coding_assistant,
|
| 1167 |
inputs=[code_prompt, code_model, max_tokens, temperature, conversation_state],
|
| 1168 |
+
outputs=[coding_output, conversation_state, coding_status, project_zip_download, single_file_download, job_state],
|
|
|
|
| 1169 |
)
|
| 1170 |
stop_button.click(fn=stop_job, inputs=job_state, outputs=coding_status)
|
| 1171 |
+
new_project_button.click(fn=clear_current_conversation, outputs=[coding_output, conversation_state, coding_status, job_state])
|
|
|
|
|
|
|
|
|
|
| 1172 |
preview_button.click(fn=preview_project, inputs=conversation_state, outputs=html_preview)
|
| 1173 |
|
| 1174 |
# --- HISTORY ---
|
| 1175 |
with gr.Tab("π History"):
|
|
|
|
|
|
|
| 1176 |
history_dropdown = gr.Dropdown(choices=[], label="Saved History", interactive=True)
|
|
|
|
| 1177 |
with gr.Row():
|
| 1178 |
refresh_history_button = gr.Button("π Refresh History")
|
| 1179 |
load_history_button = gr.Button("π Open Selected", variant="primary")
|
|
|
|
| 1180 |
history_output = gr.Markdown("Select a saved conversation.")
|
| 1181 |
history_status = gr.Markdown("")
|
| 1182 |
resume_button = gr.Button("βΆ Resume Selected Job")
|
|
|
|
| 1183 |
with gr.Row():
|
| 1184 |
delete_history_button = gr.Button("π Delete Selected", variant="stop")
|
| 1185 |
delete_all_history_button = gr.Button("π Delete All", variant="stop")
|
| 1186 |
|
| 1187 |
refresh_history_button.click(fn=refresh_history, outputs=history_dropdown)
|
| 1188 |
+
load_history_button.click(fn=load_selected_history, inputs=history_dropdown, outputs=[history_output, conversation_state, history_status, job_state])
|
| 1189 |
+
delete_history_button.click(fn=delete_selected_history, inputs=history_dropdown, outputs=[history_dropdown, history_status])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1190 |
|
| 1191 |
def delete_all(request: gr.Request):
|
| 1192 |
session_id = request.session_hash if request else "default"
|
| 1193 |
+
ids = [value for _, value in get_conversations(session_id)]
|
|
|
|
| 1194 |
delete_conversations(session_id, ids)
|
| 1195 |
return (gr.Dropdown(choices=[], value=None), "All history deleted.")
|
| 1196 |
|
| 1197 |
+
delete_all_history_button.click(fn=delete_all, outputs=[history_dropdown, history_status])
|
| 1198 |
+
resume_button.click(fn=resume_job, inputs=job_state, outputs=[history_output, history_status, project_zip_download, single_file_download])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1199 |
|
|
|
|
| 1200 |
gr.HTML(f"""
|
| 1201 |
<div id="footer">
|
| 1202 |
+
<div style="font-size:22px;font-weight:800;background:linear-gradient(90deg,#c7b7ff,#67e8f9);-webkit-background-clip:text;-webkit-text-fill-color:transparent;margin-bottom:8px;">
|
|
|
|
|
|
|
|
|
|
| 1203 |
β‘ ARISE AI STUDIO
|
| 1204 |
</div>
|
| 1205 |
+
<div style="color:#a5b4fc;font-size:13px;">Premium AI Workspace</div>
|
| 1206 |
+
<div style="margin-top:10px;font-size:12px;">Developer: <a href="{DEVELOPER_TELEGRAM}" target="_blank" style="color:#67e8f9;">@hardhackar009</a></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
</div>
|
| 1208 |
""")
|
| 1209 |
|
|
|
|
| 1210 |
demo.load(fn=None, js=PREMIUM_JS)
|
| 1211 |
|
| 1212 |
# =========================================================
|
|
|
|
| 1214 |
# =========================================================
|
| 1215 |
|
| 1216 |
if __name__ == "__main__":
|
| 1217 |
+
demo.queue(default_concurrency_limit=1, max_size=20).launch(
|
| 1218 |
+
theme=gr.themes.Soft(primary_hue="violet", secondary_hue="cyan", neutral_hue="slate"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1219 |
css=CSS,
|
| 1220 |
+
allowed_paths=[str(DATA_DIR.resolve())],
|
| 1221 |
show_error=True,
|
| 1222 |
share=False,
|
| 1223 |
)
|