Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -471,7 +471,7 @@ def generate(
|
|
| 471 |
# --- 3D Generation branch ---
|
| 472 |
if text.strip().lower().startswith("@3d"):
|
| 473 |
prompt = text[len("@3d"):].strip()
|
| 474 |
-
yield "
|
| 475 |
glb_path, used_seed = generate_3d_fn(
|
| 476 |
prompt=prompt,
|
| 477 |
seed=1,
|
|
@@ -493,7 +493,7 @@ def generate(
|
|
| 493 |
# --- Image Generation branch ---
|
| 494 |
if text.strip().lower().startswith("@image"):
|
| 495 |
prompt = text[len("@image"):].strip()
|
| 496 |
-
yield "
|
| 497 |
image_paths, used_seed = generate_image_fn(
|
| 498 |
prompt=prompt,
|
| 499 |
negative_prompt="",
|
|
@@ -516,14 +516,14 @@ def generate(
|
|
| 516 |
# If the command starts with "visit", then treat the rest as a URL
|
| 517 |
if web_command.lower().startswith("visit"):
|
| 518 |
url = web_command[len("visit"):].strip()
|
| 519 |
-
yield "
|
| 520 |
visitor = VisitWebpageTool()
|
| 521 |
content = visitor.forward(url)
|
| 522 |
yield content
|
| 523 |
else:
|
| 524 |
# Otherwise, treat the rest as a search query.
|
| 525 |
query = web_command
|
| 526 |
-
yield "
|
| 527 |
searcher = DuckDuckGoSearchTool()
|
| 528 |
results = searcher.forward(query)
|
| 529 |
yield results
|
|
@@ -532,7 +532,7 @@ def generate(
|
|
| 532 |
# --- rAgent Reasoning branch ---
|
| 533 |
if text.strip().lower().startswith("@ragent"):
|
| 534 |
prompt = text[len("@ragent"):].strip()
|
| 535 |
-
yield "
|
| 536 |
# Pass the current chat history (cleaned) to help inform the chain.
|
| 537 |
for partial in ragent_reasoning(prompt, clean_chat_history(chat_history)):
|
| 538 |
yield partial
|
|
@@ -540,7 +540,7 @@ def generate(
|
|
| 540 |
|
| 541 |
# --- YOLO Object Detection branch ---
|
| 542 |
if text.strip().lower().startswith("@yolo"):
|
| 543 |
-
yield "
|
| 544 |
if not files or len(files) == 0:
|
| 545 |
yield "Error: Please attach an image for YOLO object detection."
|
| 546 |
return
|
|
@@ -615,7 +615,7 @@ def generate(
|
|
| 615 |
|
| 616 |
# Stream the response
|
| 617 |
buffer = ""
|
| 618 |
-
yield "
|
| 619 |
for new_text in streamer:
|
| 620 |
buffer += new_text
|
| 621 |
time.sleep(0.01) # Small delay to simulate real-time streaming
|
|
@@ -659,7 +659,7 @@ def generate(
|
|
| 659 |
thread.start()
|
| 660 |
|
| 661 |
buffer = ""
|
| 662 |
-
yield "
|
| 663 |
for new_text in streamer:
|
| 664 |
buffer += new_text
|
| 665 |
buffer = buffer.replace("<|im_end|>", "")
|
|
|
|
| 471 |
# --- 3D Generation branch ---
|
| 472 |
if text.strip().lower().startswith("@3d"):
|
| 473 |
prompt = text[len("@3d"):].strip()
|
| 474 |
+
yield " > Processing 3D Mesh Generation ββββββββββ 69%"
|
| 475 |
glb_path, used_seed = generate_3d_fn(
|
| 476 |
prompt=prompt,
|
| 477 |
seed=1,
|
|
|
|
| 493 |
# --- Image Generation branch ---
|
| 494 |
if text.strip().lower().startswith("@image"):
|
| 495 |
prompt = text[len("@image"):].strip()
|
| 496 |
+
yield " > Processing Image Generation ββββββββββ 69%"
|
| 497 |
image_paths, used_seed = generate_image_fn(
|
| 498 |
prompt=prompt,
|
| 499 |
negative_prompt="",
|
|
|
|
| 516 |
# If the command starts with "visit", then treat the rest as a URL
|
| 517 |
if web_command.lower().startswith("visit"):
|
| 518 |
url = web_command[len("visit"):].strip()
|
| 519 |
+
yield " > Processing Visiting webpage ββββββββββ 69%"
|
| 520 |
visitor = VisitWebpageTool()
|
| 521 |
content = visitor.forward(url)
|
| 522 |
yield content
|
| 523 |
else:
|
| 524 |
# Otherwise, treat the rest as a search query.
|
| 525 |
query = web_command
|
| 526 |
+
yield " > Processing Web Query ββββββββββ 69%"
|
| 527 |
searcher = DuckDuckGoSearchTool()
|
| 528 |
results = searcher.forward(query)
|
| 529 |
yield results
|
|
|
|
| 532 |
# --- rAgent Reasoning branch ---
|
| 533 |
if text.strip().lower().startswith("@ragent"):
|
| 534 |
prompt = text[len("@ragent"):].strip()
|
| 535 |
+
yield " > Processing reasoning chain using Llama mode ββββββββββ 69%"
|
| 536 |
# Pass the current chat history (cleaned) to help inform the chain.
|
| 537 |
for partial in ragent_reasoning(prompt, clean_chat_history(chat_history)):
|
| 538 |
yield partial
|
|
|
|
| 540 |
|
| 541 |
# --- YOLO Object Detection branch ---
|
| 542 |
if text.strip().lower().startswith("@yolo"):
|
| 543 |
+
yield " > Processing with yolo ββββββββββ 69%"
|
| 544 |
if not files or len(files) == 0:
|
| 545 |
yield "Error: Please attach an image for YOLO object detection."
|
| 546 |
return
|
|
|
|
| 615 |
|
| 616 |
# Stream the response
|
| 617 |
buffer = ""
|
| 618 |
+
yield " > Processing with phi4 multimodal ββββββββββ 69%"
|
| 619 |
for new_text in streamer:
|
| 620 |
buffer += new_text
|
| 621 |
time.sleep(0.01) # Small delay to simulate real-time streaming
|
|
|
|
| 659 |
thread.start()
|
| 660 |
|
| 661 |
buffer = ""
|
| 662 |
+
yield " > Processing with Qwen2VL Ocr ββββββββββ 69%"
|
| 663 |
for new_text in streamer:
|
| 664 |
buffer += new_text
|
| 665 |
buffer = buffer.replace("<|im_end|>", "")
|