Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -200,7 +200,7 @@ class ZeroEngine:
|
|
| 200 |
elapsed = time.time() - start_time
|
| 201 |
tps = round(tokens_count / elapsed, 1) if elapsed > 0 else 0
|
| 202 |
|
| 203 |
-
# Gradio 6.5.0: Update
|
| 204 |
history[-1]["content"] = f"{response_text}\n\n`[{tps} t/s]`"
|
| 205 |
yield history
|
| 206 |
|
|
@@ -212,17 +212,17 @@ class ZeroEngine:
|
|
| 212 |
# --- UI INTERFACE ---
|
| 213 |
kernel = ZeroEngine()
|
| 214 |
|
| 215 |
-
|
|
|
|
| 216 |
gr.HTML("<div style='text-align: center; border-bottom: 2px solid #333; margin-bottom: 20px;'><h1>🛰️ ZEROENGINE V0.1</h1><p>Gradio 6.5.0 Production Build</p></div>")
|
| 217 |
|
| 218 |
with gr.Row():
|
| 219 |
with gr.Column(scale=8):
|
| 220 |
-
#
|
| 221 |
chat_box = gr.Chatbot(
|
| 222 |
label="Main Engine Feedback",
|
| 223 |
height=650,
|
| 224 |
show_label=False,
|
| 225 |
-
type="messages",
|
| 226 |
autoscroll=True
|
| 227 |
)
|
| 228 |
|
|
@@ -235,8 +235,7 @@ with gr.Blocks(title="ZeroEngine Kernel 6.5", theme=gr.themes.Monochrome(primary
|
|
| 235 |
)
|
| 236 |
send_btn = gr.Button("EXE", variant="primary", scale=1)
|
| 237 |
|
| 238 |
-
|
| 239 |
-
with gr.Sidebar(label="Engine Room", open=True, width=350) as sidebar:
|
| 240 |
gr.Markdown("### 🛠️ Hardware Status")
|
| 241 |
ram_metric = gr.Label(label="RAM Usage", value="0/0 GB")
|
| 242 |
cpu_metric = gr.Label(label="CPU Load", value="0%")
|
|
@@ -282,10 +281,8 @@ with gr.Blocks(title="ZeroEngine Kernel 6.5", theme=gr.themes.Monochrome(primary
|
|
| 282 |
res = kernel.boot_kernel(repo, file)
|
| 283 |
yield res, gr.update()
|
| 284 |
|
| 285 |
-
# Recurring updates (Gradio 6 native)
|
| 286 |
demo.load(update_stats, None, [ram_metric, cpu_metric], every=2)
|
| 287 |
|
| 288 |
-
# Event Handlers
|
| 289 |
scan_btn.click(on_scan, [repo_input], [quant_dropdown, log_output])
|
| 290 |
boot_btn.click(on_boot, [repo_input, quant_dropdown], [boot_status, log_output])
|
| 291 |
|
|
@@ -295,19 +292,16 @@ with gr.Blocks(title="ZeroEngine Kernel 6.5", theme=gr.themes.Monochrome(primary
|
|
| 295 |
[stitch_status]
|
| 296 |
)
|
| 297 |
|
| 298 |
-
# Inference Handling
|
| 299 |
inference_args = [user_input, chat_box, ghost_buffer]
|
| 300 |
-
|
| 301 |
user_input.submit(kernel.inference_generator, inference_args, [chat_box])
|
| 302 |
send_btn.click(kernel.inference_generator, inference_args, [chat_box])
|
| 303 |
-
|
| 304 |
-
# Clear input on submit
|
| 305 |
user_input.submit(lambda: "", None, [user_input])
|
| 306 |
|
| 307 |
# --- LAUNCH ---
|
| 308 |
if __name__ == "__main__":
|
| 309 |
-
#
|
| 310 |
demo.queue(max_size=20).launch(
|
| 311 |
server_name="0.0.0.0",
|
| 312 |
-
share=False
|
|
|
|
| 313 |
)
|
|
|
|
| 200 |
elapsed = time.time() - start_time
|
| 201 |
tps = round(tokens_count / elapsed, 1) if elapsed > 0 else 0
|
| 202 |
|
| 203 |
+
# Gradio 6.5.0: Update history dict structure
|
| 204 |
history[-1]["content"] = f"{response_text}\n\n`[{tps} t/s]`"
|
| 205 |
yield history
|
| 206 |
|
|
|
|
| 212 |
# --- UI INTERFACE ---
|
| 213 |
kernel = ZeroEngine()
|
| 214 |
|
| 215 |
+
# Removed 'theme' from gr.Blocks constructor (Moved to .launch())
|
| 216 |
+
with gr.Blocks(title="ZeroEngine Kernel 6.5") as demo:
|
| 217 |
gr.HTML("<div style='text-align: center; border-bottom: 2px solid #333; margin-bottom: 20px;'><h1>🛰️ ZEROENGINE V0.1</h1><p>Gradio 6.5.0 Production Build</p></div>")
|
| 218 |
|
| 219 |
with gr.Row():
|
| 220 |
with gr.Column(scale=8):
|
| 221 |
+
# FIXED: Removed 'type="messages"' (deprecated/auto-detected in 6.5.0)
|
| 222 |
chat_box = gr.Chatbot(
|
| 223 |
label="Main Engine Feedback",
|
| 224 |
height=650,
|
| 225 |
show_label=False,
|
|
|
|
| 226 |
autoscroll=True
|
| 227 |
)
|
| 228 |
|
|
|
|
| 235 |
)
|
| 236 |
send_btn = gr.Button("EXE", variant="primary", scale=1)
|
| 237 |
|
| 238 |
+
with gr.Sidebar(label="Engine Room", open=True, width=350):
|
|
|
|
| 239 |
gr.Markdown("### 🛠️ Hardware Status")
|
| 240 |
ram_metric = gr.Label(label="RAM Usage", value="0/0 GB")
|
| 241 |
cpu_metric = gr.Label(label="CPU Load", value="0%")
|
|
|
|
| 281 |
res = kernel.boot_kernel(repo, file)
|
| 282 |
yield res, gr.update()
|
| 283 |
|
|
|
|
| 284 |
demo.load(update_stats, None, [ram_metric, cpu_metric], every=2)
|
| 285 |
|
|
|
|
| 286 |
scan_btn.click(on_scan, [repo_input], [quant_dropdown, log_output])
|
| 287 |
boot_btn.click(on_boot, [repo_input, quant_dropdown], [boot_status, log_output])
|
| 288 |
|
|
|
|
| 292 |
[stitch_status]
|
| 293 |
)
|
| 294 |
|
|
|
|
| 295 |
inference_args = [user_input, chat_box, ghost_buffer]
|
|
|
|
| 296 |
user_input.submit(kernel.inference_generator, inference_args, [chat_box])
|
| 297 |
send_btn.click(kernel.inference_generator, inference_args, [chat_box])
|
|
|
|
|
|
|
| 298 |
user_input.submit(lambda: "", None, [user_input])
|
| 299 |
|
| 300 |
# --- LAUNCH ---
|
| 301 |
if __name__ == "__main__":
|
| 302 |
+
# FIXED: Theme and CSS parameters moved here for Gradio 6 compatibility
|
| 303 |
demo.queue(max_size=20).launch(
|
| 304 |
server_name="0.0.0.0",
|
| 305 |
+
share=False,
|
| 306 |
+
theme=gr.themes.Monochrome(primary_hue="blue", radius_size="none")
|
| 307 |
)
|