npcsh 0.3.31__py3-none-any.whl → 0.3.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. npcsh/audio.py +540 -181
  2. npcsh/audio_gen.py +1 -0
  3. npcsh/cli.py +8 -10
  4. npcsh/conversation.py +14 -251
  5. npcsh/dataframes.py +13 -5
  6. npcsh/helpers.py +5 -0
  7. npcsh/image.py +2 -2
  8. npcsh/image_gen.py +38 -38
  9. npcsh/knowledge_graph.py +4 -4
  10. npcsh/llm_funcs.py +517 -349
  11. npcsh/npc_compiler.py +32 -23
  12. npcsh/npc_sysenv.py +5 -0
  13. npcsh/plonk.py +2 -2
  14. npcsh/response.py +131 -482
  15. npcsh/search.py +5 -1
  16. npcsh/serve.py +210 -203
  17. npcsh/shell.py +11 -25
  18. npcsh/shell_helpers.py +489 -99
  19. npcsh/stream.py +87 -554
  20. npcsh/video.py +5 -2
  21. npcsh/video_gen.py +69 -0
  22. npcsh-0.3.32.dist-info/METADATA +779 -0
  23. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/RECORD +49 -47
  24. npcsh-0.3.31.dist-info/METADATA +0 -1853
  25. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/bash_executer.tool +0 -0
  26. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/calculator.tool +0 -0
  27. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/celona.npc +0 -0
  28. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/code_executor.tool +0 -0
  29. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/corca.npc +0 -0
  30. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/eriane.npc +0 -0
  31. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/foreman.npc +0 -0
  32. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/generic_search.tool +0 -0
  33. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/image_generation.tool +0 -0
  34. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/lineru.npc +0 -0
  35. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/local_search.tool +0 -0
  36. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/maurawa.npc +0 -0
  37. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh.ctx +0 -0
  38. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/npcsh_executor.tool +0 -0
  39. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/raone.npc +0 -0
  40. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/screen_cap.tool +0 -0
  41. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sibiji.npc +0 -0
  42. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/slean.npc +0 -0
  43. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/sql_executor.tool +0 -0
  44. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/test_pipeline.py +0 -0
  45. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/turnic.npc +0 -0
  46. {npcsh-0.3.31.data → npcsh-0.3.32.data}/data/npcsh/npc_team/welxor.npc +0 -0
  47. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/WHEEL +0 -0
  48. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/entry_points.txt +0 -0
  49. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/licenses/LICENSE +0 -0
  50. {npcsh-0.3.31.dist-info → npcsh-0.3.32.dist-info}/top_level.txt +0 -0
npcsh/video.py CHANGED
@@ -1,6 +1,9 @@
1
- # video.py
1
+ # video.py
2
+
2
3
 
3
4
  def process_video(file_path, table_name):
5
+ # implement with moon dream
6
+
4
7
  embeddings = []
5
8
  texts = []
6
9
  try:
@@ -46,4 +49,4 @@ def process_video(file_path, table_name):
46
49
 
47
50
  except Exception as e:
48
51
  print(f"Error processing video: {e}")
49
- return [], [] # Return empty lists in case of error
52
+ return [], [] # Return empty lists in case of error
npcsh/video_gen.py ADDED
@@ -0,0 +1,69 @@
1
+ def generate_video_diffusers(
2
+ prompt,
3
+ model,
4
+ npc=None,
5
+ device="cpu",
6
+ output_path="",
7
+ num_inference_steps=10,
8
+ num_frames=125,
9
+ height=256,
10
+ width=256,
11
+ ):
12
+
13
+ import torch
14
+ from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
15
+ import numpy as np
16
+ import cv2
17
+
18
+ # Load pipeline
19
+ pipe = DiffusionPipeline.from_pretrained(
20
+ "damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float32
21
+ ).to(device)
22
+ pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
23
+
24
+ output = pipe(
25
+ prompt,
26
+ num_inference_steps=num_inference_steps,
27
+ num_frames=num_frames,
28
+ height=height,
29
+ width=width,
30
+ )
31
+
32
+ def save_frames_to_video(frames, output_path, fps=8):
33
+ """Handle the specific 5D array format (1, num_frames, H, W, 3) with proper type conversion"""
34
+ # Verify input format
35
+ if not (
36
+ isinstance(frames, np.ndarray)
37
+ and frames.ndim == 5
38
+ and frames.shape[-1] == 3
39
+ ):
40
+ raise ValueError(
41
+ f"Unexpected frame format. Expected 5D RGB array, got {frames.shape}"
42
+ )
43
+
44
+ # Remove batch dimension and convert to 0-255 uint8
45
+ frames = (frames[0] * 255).astype(np.uint8) # Shape: (num_frames, H, W, 3)
46
+
47
+ # Get video dimensions
48
+ height, width = frames.shape[1:3]
49
+
50
+ # Create video writer
51
+ fourcc = cv2.VideoWriter_fourcc(*"mp4v")
52
+ video_writer = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
53
+
54
+ if not video_writer.isOpened():
55
+ raise IOError(f"Could not open video writer for {output_path}")
56
+
57
+ # Write frames (convert RGB to BGR for OpenCV)
58
+ for frame in frames:
59
+ video_writer.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
60
+
61
+ video_writer.release()
62
+ print(f"Successfully saved {frames.shape[0]} frames to {output_path}")
63
+
64
+ os.makedirs("~/.npcsh/videos/")
65
+ if output_path == "":
66
+
67
+ output_path = "~/.npcsh/videos/" + prompt[0:8] + ".mp4"
68
+ save_frames_to_video(output.frames, output_path)
69
+ return output_path