unique-interface 0.1.0__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.
- unique_interface-0.1.0/LICENSE +21 -0
- unique_interface-0.1.0/PKG-INFO +45 -0
- unique_interface-0.1.0/README.md +31 -0
- unique_interface-0.1.0/pyproject.toml +18 -0
- unique_interface-0.1.0/setup.cfg +4 -0
- unique_interface-0.1.0/tests/test_ui.py +34 -0
- unique_interface-0.1.0/unique_interface/__init__.py +141 -0
- unique_interface-0.1.0/unique_interface/logo.b64 +1 -0
- unique_interface-0.1.0/unique_interface.egg-info/PKG-INFO +45 -0
- unique_interface-0.1.0/unique_interface.egg-info/SOURCES.txt +11 -0
- unique_interface-0.1.0/unique_interface.egg-info/dependency_links.txt +1 -0
- unique_interface-0.1.0/unique_interface.egg-info/requires.txt +2 -0
- unique_interface-0.1.0/unique_interface.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Unique50101
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unique-interface
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unique's black-and-white chat and file-review components for Python notebooks.
|
|
5
|
+
Author: Unique50101
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/Unique50101/unique-interface
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: ipywidgets<9,>=8.1
|
|
12
|
+
Requires-Dist: ipython>=8
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Unique Interface
|
|
16
|
+
|
|
17
|
+
Build a black-and-white chat or file-review panel inside Colab, JupyterLab, or a VS Code Python notebook. Both components use the Unique logo. The package renders through ipywidgets and runs callbacks in the notebook kernel.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
%pip install unique-interface
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from unique_interface import ChatInterface
|
|
25
|
+
|
|
26
|
+
def reply(message, history):
|
|
27
|
+
return f"You wrote: {message}"
|
|
28
|
+
|
|
29
|
+
chat = ChatInterface(reply, title="My chat").launch()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Chat supports send, retry, clear, and per-instance conversation history. The callback receives the new text and previous messages as role/content dictionaries. Supply your own model or Python function. A failed callback leaves the conversation available for retry.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from unique_interface import FileInterface
|
|
36
|
+
|
|
37
|
+
def inspect_file(path, folder):
|
|
38
|
+
return f"{path.stat().st_size} bytes received", None
|
|
39
|
+
|
|
40
|
+
panel = FileInterface(inspect_file, title="Inspect a file").launch()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The file callback receives a temporary input path and working directory. Return a plain-text summary and optionally a generated path for download. The input limit defaults to 10 MiB. In Colab enable the custom widget manager before launching. In local JupyterLab or desktop VS Code choose the Python kernel with this package installed.
|
|
44
|
+
|
|
45
|
+
[Run UniqueChat](https://colab.research.google.com/github/Unique50101/uniquechat/blob/main/UniqueChat.ipynb) · [Run SheetReview](https://colab.research.google.com/github/Unique50101/unique-sheetreview/blob/main/SheetReview.ipynb)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Unique Interface
|
|
2
|
+
|
|
3
|
+
Build a black-and-white chat or file-review panel inside Colab, JupyterLab, or a VS Code Python notebook. Both components use the Unique logo. The package renders through ipywidgets and runs callbacks in the notebook kernel.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
%pip install unique-interface
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from unique_interface import ChatInterface
|
|
11
|
+
|
|
12
|
+
def reply(message, history):
|
|
13
|
+
return f"You wrote: {message}"
|
|
14
|
+
|
|
15
|
+
chat = ChatInterface(reply, title="My chat").launch()
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Chat supports send, retry, clear, and per-instance conversation history. The callback receives the new text and previous messages as role/content dictionaries. Supply your own model or Python function. A failed callback leaves the conversation available for retry.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from unique_interface import FileInterface
|
|
22
|
+
|
|
23
|
+
def inspect_file(path, folder):
|
|
24
|
+
return f"{path.stat().st_size} bytes received", None
|
|
25
|
+
|
|
26
|
+
panel = FileInterface(inspect_file, title="Inspect a file").launch()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The file callback receives a temporary input path and working directory. Return a plain-text summary and optionally a generated path for download. The input limit defaults to 10 MiB. In Colab enable the custom widget manager before launching. In local JupyterLab or desktop VS Code choose the Python kernel with this package installed.
|
|
30
|
+
|
|
31
|
+
[Run UniqueChat](https://colab.research.google.com/github/Unique50101/uniquechat/blob/main/UniqueChat.ipynb) · [Run SheetReview](https://colab.research.google.com/github/Unique50101/unique-sheetreview/blob/main/SheetReview.ipynb)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
[project]
|
|
5
|
+
name = "unique-interface"
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
description = "Unique's black-and-white chat and file-review components for Python notebooks."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [{name = "Unique50101"}]
|
|
12
|
+
dependencies = ["ipywidgets>=8.1,<9", "ipython>=8"]
|
|
13
|
+
[project.urls]
|
|
14
|
+
Repository = "https://github.com/Unique50101/unique-interface"
|
|
15
|
+
[tool.setuptools]
|
|
16
|
+
packages = ["unique_interface"]
|
|
17
|
+
[tool.setuptools.package-data]
|
|
18
|
+
unique_interface = ["logo.b64"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from unique_interface import ChatInterface, FileInterface
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Interfaces(unittest.TestCase):
|
|
6
|
+
def test_chat(self):
|
|
7
|
+
calls = []
|
|
8
|
+
def answer(message, history):
|
|
9
|
+
calls.append((message, history))
|
|
10
|
+
return "<hello>"
|
|
11
|
+
ui = ChatInterface(answer)
|
|
12
|
+
ui.prompt.value = "Hi"
|
|
13
|
+
ui.send.click()
|
|
14
|
+
ui.prompt.value = "Again"
|
|
15
|
+
ui.send.click()
|
|
16
|
+
ui.retry.click()
|
|
17
|
+
self.assertEqual(len(ui.history), 4)
|
|
18
|
+
self.assertEqual(len(calls[-1][1]), 2)
|
|
19
|
+
self.assertIn("<hello>", ui.log.value)
|
|
20
|
+
ui.clear.click()
|
|
21
|
+
self.assertFalse(ui.history)
|
|
22
|
+
|
|
23
|
+
def test_file(self):
|
|
24
|
+
from datetime import datetime, timezone
|
|
25
|
+
def review(path, folder):
|
|
26
|
+
out = folder / "copy.csv"
|
|
27
|
+
out.write_bytes(path.read_bytes())
|
|
28
|
+
return "<done>", out
|
|
29
|
+
ui = FileInterface(review)
|
|
30
|
+
ui.upload.value = (dict(name="demo.csv", size=3, type="text/csv",
|
|
31
|
+
content=memoryview(b"a,b"),last_modified=datetime.now(timezone.utc)),)
|
|
32
|
+
ui.run.click()
|
|
33
|
+
self.assertIn("<done>", ui.result.value)
|
|
34
|
+
self.assertIn('download="copy.csv"', ui.result.value)
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""Unique's notebook-native chat and file interfaces."""
|
|
2
|
+
from base64 import b64encode
|
|
3
|
+
from html import escape
|
|
4
|
+
from importlib.resources import files
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from tempfile import TemporaryDirectory
|
|
7
|
+
|
|
8
|
+
import ipywidgets as w
|
|
9
|
+
from IPython.display import display
|
|
10
|
+
|
|
11
|
+
_STYLE = """
|
|
12
|
+
.unique-panel{background:white!important;color:#171717!important;border:1px solid #aaa;border-radius:14px;padding:14px;max-width:780px;width:100%!important;box-sizing:border-box;font-family:system-ui,sans-serif}
|
|
13
|
+
.unique-panel .widget-button{border-radius:6px;color:#111;background:white;border:1px solid #777}
|
|
14
|
+
.unique-panel .unique-primary,.unique-panel .unique-primary button{background:#151515!important;color:white!important}
|
|
15
|
+
.unique-panel textarea{background:white!important;color:#151515!important;border:1px solid #777!important;border-radius:6px}
|
|
16
|
+
.unique-panel .widget-html{color:#171717}
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _heading(title):
|
|
21
|
+
logo = files("unique_interface").joinpath("logo.b64").read_text().strip()
|
|
22
|
+
return w.HTML(f'<style>{_STYLE}</style><div style="background:#111;color:white;border-radius:8px;display:flex;align-items:center;gap:14px;padding:8px 14px">'
|
|
23
|
+
f'<img src="data:image/png;base64,{logo}" alt="Unique" width="66" height="66" style="object-fit:contain">'
|
|
24
|
+
f'<strong style="font:600 19px system-ui">{escape(title)}</strong></div>')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _panel(*items):
|
|
28
|
+
return w.VBox(items, layout=w.Layout(width="100%")).add_class("unique-panel")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _button(label, primary=False):
|
|
32
|
+
b = w.Button(description=label, layout=w.Layout(width="auto"))
|
|
33
|
+
if primary:
|
|
34
|
+
b.add_class("unique-primary")
|
|
35
|
+
b.style.button_color = "#151515"
|
|
36
|
+
b.style.text_color = "white"
|
|
37
|
+
return b
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ChatInterface:
|
|
41
|
+
"""Display a text chat. fn(message, history) returns the next reply."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, fn, *, title="Unique Chat"):
|
|
44
|
+
self.fn = fn
|
|
45
|
+
self.history = []
|
|
46
|
+
self.log = w.HTML()
|
|
47
|
+
self.prompt = w.Textarea(placeholder="Type your message…", layout=w.Layout(width="100%"))
|
|
48
|
+
self.status = w.Label()
|
|
49
|
+
self.send = _button("Send", True)
|
|
50
|
+
self.retry = _button("Retry last reply")
|
|
51
|
+
self.clear = _button("Clear chat")
|
|
52
|
+
self.send.on_click(lambda _: self._respond(False))
|
|
53
|
+
self.retry.on_click(lambda _: self._respond(True))
|
|
54
|
+
self.clear.on_click(lambda _: self.reset())
|
|
55
|
+
self.widget = _panel(_heading(title), self.log, self.prompt,
|
|
56
|
+
w.HBox([self.send, self.retry, self.clear]), self.status)
|
|
57
|
+
self._render()
|
|
58
|
+
|
|
59
|
+
def _render(self):
|
|
60
|
+
rows = []
|
|
61
|
+
for item in self.history:
|
|
62
|
+
who = "You" if item["role"] == "user" else "Unique"
|
|
63
|
+
rows.append(f'<div style="padding:8px 0;border-bottom:1px solid #ddd"><b>{who}</b>'
|
|
64
|
+
f'<div style="white-space:pre-wrap;overflow-wrap:anywhere">{escape(item["content"])}</div></div>')
|
|
65
|
+
self.log.value = "".join(rows)
|
|
66
|
+
self.retry.disabled = not self.history
|
|
67
|
+
|
|
68
|
+
def reset(self):
|
|
69
|
+
self.history.clear()
|
|
70
|
+
self.prompt.value = self.status.value = ""
|
|
71
|
+
self._render()
|
|
72
|
+
|
|
73
|
+
def _respond(self, retry):
|
|
74
|
+
if retry and not self.history:
|
|
75
|
+
return
|
|
76
|
+
message = self.history[-2]["content"] if retry else self.prompt.value.strip()
|
|
77
|
+
if not message:
|
|
78
|
+
self.status.value = "Enter a message first."
|
|
79
|
+
return
|
|
80
|
+
prior = self.history[:-2] if retry else self.history[:]
|
|
81
|
+
self.send.disabled = self.clear.disabled = self.retry.disabled = True
|
|
82
|
+
self.status.value = "Generating reply…"
|
|
83
|
+
try:
|
|
84
|
+
reply = self.fn(message, [dict(m) for m in prior])
|
|
85
|
+
if not isinstance(reply, str) or not reply.strip():
|
|
86
|
+
raise ValueError("The callback must return a nonempty reply.")
|
|
87
|
+
self.history = prior + [dict(role="user", content=message), dict(role="assistant", content=reply)]
|
|
88
|
+
if not retry:
|
|
89
|
+
self.prompt.value = ""
|
|
90
|
+
self.status.value = ""
|
|
91
|
+
except Exception as exc:
|
|
92
|
+
self.status.value = str(exc)
|
|
93
|
+
finally:
|
|
94
|
+
self.send.disabled = self.clear.disabled = False
|
|
95
|
+
self._render()
|
|
96
|
+
|
|
97
|
+
def launch(self):
|
|
98
|
+
display(self.widget)
|
|
99
|
+
return self
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class FileInterface:
|
|
103
|
+
"""fn(path, directory) returns (plain-text report, optional output path)."""
|
|
104
|
+
|
|
105
|
+
def __init__(self, fn, *, title="Unique File Review", accept=".csv,.xlsx", max_bytes=10*1024*1024):
|
|
106
|
+
self.fn, self.max_bytes = fn, max_bytes
|
|
107
|
+
self.upload = w.FileUpload(accept=accept, multiple=False)
|
|
108
|
+
self.run = _button("Review file", True)
|
|
109
|
+
self.result = w.HTML()
|
|
110
|
+
self.run.on_click(lambda _: self._review())
|
|
111
|
+
self.widget = _panel(_heading(title), self.upload, self.run, self.result)
|
|
112
|
+
|
|
113
|
+
def _review(self):
|
|
114
|
+
selected = self.upload.value
|
|
115
|
+
if not selected:
|
|
116
|
+
self.result.value = "Choose a file first."
|
|
117
|
+
return
|
|
118
|
+
self.run.disabled = True
|
|
119
|
+
try:
|
|
120
|
+
name, data = selected[0]["name"], selected[0]["content"]
|
|
121
|
+
if len(data) > self.max_bytes:
|
|
122
|
+
raise ValueError("Choose a smaller file.")
|
|
123
|
+
with TemporaryDirectory() as work:
|
|
124
|
+
folder = Path(work)
|
|
125
|
+
source = folder / ("input" + Path(name).suffix.lower())
|
|
126
|
+
source.write_bytes(data)
|
|
127
|
+
summary, output = self.fn(source, folder)
|
|
128
|
+
result = f'<pre style="white-space:pre-wrap">{escape(str(summary))}</pre>'
|
|
129
|
+
if output is not None:
|
|
130
|
+
output = Path(output)
|
|
131
|
+
payload = b64encode(output.read_bytes()).decode()
|
|
132
|
+
result += f'<a style="color:#111;text-decoration:underline" download="{escape(output.name)}" href="data:application/octet-stream;base64,{payload}">Download {escape(output.name)}</a>'
|
|
133
|
+
self.result.value = result
|
|
134
|
+
except Exception as exc:
|
|
135
|
+
self.result.value = escape(str(exc))
|
|
136
|
+
finally:
|
|
137
|
+
self.run.disabled = False
|
|
138
|
+
|
|
139
|
+
def launch(self):
|
|
140
|
+
display(self.widget)
|
|
141
|
+
return self
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAIAAADdvvtQAAAX/UlEQVR42u2ceXTV1bXH997n3hBBBjHMlTIoioISxdaxfU9tUdSWtgGx2kHEuuoMTnV4z/qeupZoHYJMIli1dSlPVLqWxgHRtmJtfUqULiQgRZlKAoFABsj9nbP3++Oc3+/ejCQQhGf3B2Qly5tzf/f89tnDd+9fABRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURTlQEKIhLoNew920G0AARBBAEAUABBp95UggoggoIDsd7shGj58+LfOPJOMWbVq1eLFi0VErWEvSO37ErfeemufPn381wKCgCIye9as1Z991sYVxo8ff8opp3jTQUQAAJGnn3mmtLR0vxwaxClTpt5996/zO+UDgog89fRTV//yl/WZSA3iAISAT1d8GkXWWceOrXU2cpkoOuecc9p+O6dPfyzKWBuvEGXs7l3148eP30/XfMopp9TXZ9ixiIiIs846d+WVV+rd3BsD6IDjTEiIgCAgBgkJEKBdYQgRCBEBkRARiIj2W2KCiGPHnm+IQNBfIxkyQCNGjFBrOAAGJCLMQkgEREQAQEAIwI7bZ4QpIERgAAHC/ZjZYoiSRoCDpbMwMCESajr95XsgAEQAAgEBBgBgEEBsd3bOyCDeHwDB/ktpWWDRHxaxRIAg7F2lAMCHH33EmkcfEAPy246E7M80IIigtMOCBIBBCJBjG9yv/O8HH0yaNKm8ooLZOXGZTKa4uPi3v31SreHAVGEAwsw+fnmTtO3MgbwAIATE5MPM/o4lz/7+9yUlJeeff346lXr7nXe++PxzZnU/B8iAEJGAhIWAQICB23v7RUAASABov7ufOJBJZWXl008/rRZw4A1IBBiAAAGBhRFIQNpZRknIb9nbEjZVOBGxkcaY5ElE2Lt3n8JRo7p17yYC9Zn6NZ+tWbFiBTO3YvSx3tR4tebybgDEHj16jB49uudhhyFRFEVrP1/7ycefWGsxXD34FbPfAjRKqjAnSfcv20Oqh4gAhMBtuMgkH02l0qNHn9S//wBERERnbdmqVWVlZeys7AeJtkM8EBCBMCACCfnEtF35KBISITP4OAYALlEUAYjozjvuPPW0UxHBOWG2RPTII4++tfhNQDz55G/efvttY8aMISS/lDihFH300UdPPf3043NmR5Ft9HaDBg2ePr04Ly/POeesBURD5t777l26dGmzlzds2LDb77izaPyP0pRGQkBgy4CwYeOGZ5555oFp02rr6sZ8d8w1114DInl5nZw4dmxSqcmXT9q4cZNfZODAgTNmzEin0845ADDGRFF04003ripb1fyNSaWeffbZQw/tQmSiKPL78Pobrxc/WtySsZ08evTlkydfeOGFvQp6MYsxBAjMIsLr1617taTk0Uce+cfatQeX5o6IK1Z8KkGSC3+ttWeddVbbV5gxc6Y4Dj8uIk4ymcyEWEg0xrz00ksiYiNrI+ucWGsvvfRSALj22murqqpsFCWSoFgnIs6JOLbWvvDCC8aYRu94YmGhtTZZ0F9wUVFRM3fR0A1TpmzZstW/3r+F/xu+da60dFnv3r0nX365tZadOOustdY6a+3QoUOSpUaOGFm/u56dExEbORvZTBSdesqpLW1LXl5edXW1iHhtVljEybx587A5raFb167PP/fcrl27shfpXHZPwpdSVVV1yy23YIeqFR1Uxid+mUDiiNQ+MQkEAEIV1lSKRAAHhERBbIJUyvzq1l/95jcPde/e3VAq/JwhQGJgAAZCY8y474+bOXMmNYwd/orFARGalGlJNUDEX9/93w8+8EBBweHevQEAIRESGUq844jjRi5cuLBTfj4iIgEgGDQYigtpFDRFgJlNipAMsLRSLBARIjIDIpgUAYJj59g1/Ym+ffq+/c4fx4+f0CmvEzsGBkDw28SOCSjcZIauh3a99557582f16VLl4OqCgvxCwT2MsaKBAmSyZuCNExBUJCBicjnScBw9lnnXPzjixENOyGDABAqwfgPsxekcNJlk958442FCxdKnG2JiLAIcbLLTdOLFNGtt91+8803IxofGUN2TwAMwuAtih0j4WmnndavXz8QYMf+FBGQc04aHpLc8pIIHO7hUAkLCHtjTYTZRjszaNCgF198acTIkV56FSfe+HyjJrnDwuK/JUM/++nPehX0Kioqqq+vPyg8EAD4kycg3nnsVRVOwMDIEEwIMD704gt7pDjVRiS8+OKLjTFEICA2slEUMXOSNTODz8XJUCqduu3225EoN+tHxOBFBBAb+FDPiOOPv+u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yfp6bwfD78K/wOc/VAHWNB3nQSeeKrE7DVgL6MrEhysuFYYPwX8UAawjosAQpqr9cGHYCAc6wGpLQVL6MLi/+dL8mzzGpAyp555+13rpg8OYyvgwCAManKykrdGaV9tRjE08eKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoiiKoijKAeD/AK2eOYC01Et+AAAAAElFTkSuQmCC
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unique-interface
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unique's black-and-white chat and file-review components for Python notebooks.
|
|
5
|
+
Author: Unique50101
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/Unique50101/unique-interface
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: ipywidgets<9,>=8.1
|
|
12
|
+
Requires-Dist: ipython>=8
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Unique Interface
|
|
16
|
+
|
|
17
|
+
Build a black-and-white chat or file-review panel inside Colab, JupyterLab, or a VS Code Python notebook. Both components use the Unique logo. The package renders through ipywidgets and runs callbacks in the notebook kernel.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
%pip install unique-interface
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from unique_interface import ChatInterface
|
|
25
|
+
|
|
26
|
+
def reply(message, history):
|
|
27
|
+
return f"You wrote: {message}"
|
|
28
|
+
|
|
29
|
+
chat = ChatInterface(reply, title="My chat").launch()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Chat supports send, retry, clear, and per-instance conversation history. The callback receives the new text and previous messages as role/content dictionaries. Supply your own model or Python function. A failed callback leaves the conversation available for retry.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from unique_interface import FileInterface
|
|
36
|
+
|
|
37
|
+
def inspect_file(path, folder):
|
|
38
|
+
return f"{path.stat().st_size} bytes received", None
|
|
39
|
+
|
|
40
|
+
panel = FileInterface(inspect_file, title="Inspect a file").launch()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The file callback receives a temporary input path and working directory. Return a plain-text summary and optionally a generated path for download. The input limit defaults to 10 MiB. In Colab enable the custom widget manager before launching. In local JupyterLab or desktop VS Code choose the Python kernel with this package installed.
|
|
44
|
+
|
|
45
|
+
[Run UniqueChat](https://colab.research.google.com/github/Unique50101/uniquechat/blob/main/UniqueChat.ipynb) · [Run SheetReview](https://colab.research.google.com/github/Unique50101/unique-sheetreview/blob/main/SheetReview.ipynb)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
tests/test_ui.py
|
|
5
|
+
unique_interface/__init__.py
|
|
6
|
+
unique_interface/logo.b64
|
|
7
|
+
unique_interface.egg-info/PKG-INFO
|
|
8
|
+
unique_interface.egg-info/SOURCES.txt
|
|
9
|
+
unique_interface.egg-info/dependency_links.txt
|
|
10
|
+
unique_interface.egg-info/requires.txt
|
|
11
|
+
unique_interface.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
unique_interface
|