sinapsis 0.2.1__tar.gz → 0.2.2__tar.gz

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 (21) hide show
  1. {sinapsis-0.2.1 → sinapsis-0.2.2}/PKG-INFO +3 -3
  2. {sinapsis-0.2.1 → sinapsis-0.2.2}/pyproject.toml +8 -1
  3. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/webapp/agent_gradio_helper.py +5 -1
  4. sinapsis-0.2.2/src/sinapsis/webapp/agent_webapp_utils.py +50 -0
  5. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/PKG-INFO +3 -3
  6. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/requires.txt +3 -0
  7. sinapsis-0.2.1/src/sinapsis/webapp/agent_webapp_utils.py +0 -25
  8. {sinapsis-0.2.1 → sinapsis-0.2.2}/LICENSE +0 -0
  9. {sinapsis-0.2.1 → sinapsis-0.2.2}/README.md +0 -0
  10. {sinapsis-0.2.1 → sinapsis-0.2.2}/setup.cfg +0 -0
  11. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/__init__.py +0 -0
  12. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/bin/sinapsis_cli.py +0 -0
  13. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/templates/__init__.py +0 -0
  14. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/templates/display_hello_world.py +0 -0
  15. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/templates/hello_world.py +0 -0
  16. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/webapp/__init__.py +0 -0
  17. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis/webapp/chatbot_base.py +0 -0
  18. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/SOURCES.txt +0 -0
  19. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/dependency_links.txt +0 -0
  20. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/entry_points.txt +0 -0
  21. {sinapsis-0.2.1 → sinapsis-0.2.2}/src/sinapsis.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sinapsis
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Modular and Universal AI platform
5
5
  Author-email: SinapsisAI <dev@sinapsis.tech>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -671,11 +671,11 @@ Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
671
671
  Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis.git
672
672
  Requires-Python: >=3.10
673
673
  Description-Content-Type: text/markdown
674
- License-File: LICENSE
675
674
  Requires-Dist: sinapsis-core>=0.1.0
676
675
  Provides-Extra: all
677
676
  Requires-Dist: sinapsis[dev]; extra == "all"
678
- Dynamic: license-file
677
+ Provides-Extra: webapp
678
+ Requires-Dist: gradio>=5.23.3; extra == "webapp"
679
679
 
680
680
  <h1 align="center">
681
681
  <br>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sinapsis"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Modular and Universal AI platform"
5
5
  authors = [
6
6
  {name = "SinapsisAI", email = "dev@sinapsis.tech"},
@@ -26,6 +26,9 @@ sinapsis = "sinapsis.bin.sinapsis_cli:main"
26
26
  all = [
27
27
  "sinapsis[dev]",
28
28
  ]
29
+ webapp = [
30
+ "gradio>=5.23.3",
31
+ ]
29
32
 
30
33
 
31
34
  [tool.ruff]
@@ -59,6 +62,10 @@ sinapsis-core = { index = "sinapsis-core" }
59
62
  name = "sinapsis-core"
60
63
  url = "https://pypi.sinapsis.tech/"
61
64
 
65
+
66
+ [tool.setuptools]
67
+ license-files = []
68
+
62
69
  [build-system]
63
70
  requires = ["setuptools"]
64
71
  build-backend = "setuptools.build_meta"
@@ -35,6 +35,7 @@ def init_image_inference(
35
35
  stream: bool = False,
36
36
  image_input: gr.Image | None = gr.Image,
37
37
  app_message: str | None = None,
38
+ examples: list[str] | None = None,
38
39
  ):
39
40
  """
40
41
  Method to perform inference on the input from gradio
@@ -44,6 +45,7 @@ def init_image_inference(
44
45
  stream (bool) : Whether to consume a single image (False) or a video (True)
45
46
  image_input (gr.Image | None): Whether the app takes an input image or not
46
47
  app_message (str | None): The message that shows up in the interface when starting it.
48
+ examples (list | None): Adds example images to the gradio app
47
49
  """
48
50
  input_sources = ["webcam"]
49
51
  if not stream:
@@ -60,6 +62,7 @@ def init_image_inference(
60
62
  title=title,
61
63
  flagging_mode="never",
62
64
  article=app_message,
65
+ examples=examples,
63
66
  )
64
67
  return live_interface
65
68
 
@@ -117,10 +120,11 @@ def add_logo_and_title(page_title: str | None = None) -> None:
117
120
  logo_path,
118
121
  elem_id="sinapsis-logo",
119
122
  width=800,
120
- height=50,
123
+ height=150,
121
124
  show_label=False,
122
125
  show_download_button=False,
123
126
  show_fullscreen_button=False,
127
+ scale=0.5,
124
128
  )
125
129
 
126
130
  gr.Markdown(f"# {page_title}", elem_id="title")
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ from pathlib import Path
3
+ from typing import Any
4
+
5
+ from sinapsis_core.agent import Agent
6
+ from sinapsis_core.cli.run_agent_from_config import AgentMode
7
+ from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket
8
+ from sinapsis_core.utils.logging_utils import sinapsis_logger
9
+
10
+
11
+ def infer_image(agent: Agent, image: Any) -> Any:
12
+ """Method used in apps that require an image input
13
+ Args:
14
+ agent (Agent): Agent instance
15
+ image (Any): input from the gradio/streamlit app
16
+ Returns:
17
+ the final image content after agent execution
18
+ """
19
+ if image is None:
20
+ return None
21
+ container = DataContainer()
22
+ container.images = [
23
+ ImagePacket(
24
+ content=image,
25
+ source="live_stream",
26
+ )
27
+ ]
28
+ result_container = agent(container)
29
+ return result_container.images[-1].content
30
+
31
+
32
+ def infer_video(agent: Agent, video: Any) -> Path:
33
+ """Processes an input video using the CoTracker agent and returns the path to the output video.
34
+
35
+ Args:
36
+ agent (Agent): Agent instance
37
+ video (Any): The input video file or path.
38
+
39
+ Returns:
40
+ Path: The file path to the processed video.
41
+ """
42
+ agent.update_template_attribute("VideoReaderCV2", "video_file_path", video)
43
+ agent.reset_state()
44
+ for _ in agent(None, AgentMode.GENERATOR):
45
+ pass
46
+ agent.topological_sort["VideoWriterCV2"].template_instance.video_writer_is_done()
47
+ sinapsis_logger.debug("Finished processing video")
48
+ path = agent.topological_sort["VideoWriterCV2"].metadata.attributes["destination_path"]
49
+
50
+ return Path(path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sinapsis
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Modular and Universal AI platform
5
5
  Author-email: SinapsisAI <dev@sinapsis.tech>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -671,11 +671,11 @@ Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
671
671
  Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis.git
672
672
  Requires-Python: >=3.10
673
673
  Description-Content-Type: text/markdown
674
- License-File: LICENSE
675
674
  Requires-Dist: sinapsis-core>=0.1.0
676
675
  Provides-Extra: all
677
676
  Requires-Dist: sinapsis[dev]; extra == "all"
678
- Dynamic: license-file
677
+ Provides-Extra: webapp
678
+ Requires-Dist: gradio>=5.23.3; extra == "webapp"
679
679
 
680
680
  <h1 align="center">
681
681
  <br>
@@ -2,3 +2,6 @@ sinapsis-core>=0.1.0
2
2
 
3
3
  [all]
4
4
  sinapsis[dev]
5
+
6
+ [webapp]
7
+ gradio>=5.23.3
@@ -1,25 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from typing import Any
3
-
4
- from sinapsis_core.agent import Agent
5
- from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket
6
-
7
-
8
- def infer_image(agent: Agent, image: Any) -> Any:
9
- """Method used in apps that require an image input
10
- Args:
11
- agent (Agent): Agent instance
12
- image (Any): input from the gradio/streamlit app
13
- Returns:
14
- the final image content after agent execution
15
- """
16
-
17
- container = DataContainer()
18
- container.images = [
19
- ImagePacket(
20
- content=image,
21
- source="live_stream",
22
- )
23
- ]
24
- result_container = agent(container)
25
- return result_container.images[-1].content
File without changes
File without changes
File without changes