V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  stebest  ›  全部回复第 1 页 / 共 34 页
回复总数  669
1  2  3  4  5  6  7  8  9  10 ... 34  
13 天前
回复了 stebest 创建的主题 分享创造 Prompt 管理中心
添加了一个简单的 web 前端,可以网页管理了
17 天前
回复了 stebest 创建的主题 分享创造 Prompt 管理中心
@maggch97 如果能保证一直不变,那放哪可能都有说辞。但实际开发过程中,prompt 会根据效果调整,一直不变的很少
名称: git-commit-helper
地址: https://github.com/newdee/git-commit-helper
描述:一键生成规范且有意义的 git commit 并自动提交,支持 gpgsign ,也可无缝集成进 lazygit
检索用的 RAG 还是什么
@yb2313 说到 rust 中的?,由于 python 中没有办法重载,加了一个 spread 来实现类似的功能了哈哈
@yb2313 还好,只是可以直接通过返回值来捕获错误也方便不少,毕竟做不到 rust 那么完善,但有些风格可以借鉴一下,先试着把哈哈,跟上面说的,到头来屎上雕花也可能。
@yb2313 哈哈,就觉得他们的错误处理比较好,go 的返回方式也行,后面看看要不要也整一个。
@3085570450tt 这个感觉跟前面那个 Result 挺像的,也是刚写不久,不过 result 我倒是也有加,看来 rust 的枚举确实还是有人受用,不过 Result 坚持了那么久最后还是放弃了,我也只能说写点觉得实用的工具类放进去,后面遇到了也会放进去,说不定哪天官方版本自己有这些类似实现,或者更新不需要这些了,自然我这个也该废弃了。主打利己,如果对其他人有用那也更好。
@arielherself 你说的这个都没人维护了呀,最后一次三年前了,到现在 pyright 都不会让它过了。另外我这个只是自己觉得有用的就加进去,只是现在只加了这俩。
@ispinfx python2 的时代确实是噩梦,现在好歹有了 type hint ,也有了 match 语法,也确实增加了一些可读性,知道这坨谁拉的,为什么拉,拉的咋样起码是好事,毕竟生态强大有时候确实离不开。说到屎上雕花,我觉得像这种 https://github.com/The-Pocket/PocketFlow 为了精简而精简,一百行代码 ruff 报了三百行 warning ,一瞬间仿佛回到了 python2 的年代,可读性和安全性极差,可能更像你说的 hh 。
@BaobhanSith 没事,问题应该不大,我在 arm 的 mac 下用 npm 也没遇到过啥问题。不介意我软广就行 hh
不需要本人有 arm 设备,可以用 github 的 workflow 发布到不同平台,github action 每个月有免费额度,可以参照这个 https://github.com/newdee/git-commit-helper/blob/main/.github/workflows/rust.yml ,不过话说要不要默认支持一下 ai 自动 git commit ,懒人必备:dog2:
@voyagerth1 那个貌似只有 result 吧,而且代码很老了,已经停止维护了
86 天前
回复了 uxiaohan 创建的主题 分享创造 辟谣,辟谣!
你这个 git 提交信息优点太粗暴了,要不要用一下这个 https://github.com/newdee/git-commit-helper/tree/main 自动生成优雅的提交信息:doge:
2024-08-02 14:05:10 +08:00
回复了 Haku 创建的主题 Python Python 中如何在内存中优雅地提取视频帧?
如果还是希望用 opencv video capture 处理,1.可以将视频流使用虚拟摄像头输出,用 opencv 打开即可。
2.使用流媒体协议,opencv video capture 应该也直接支持。
3.使用 videogear 的 netgear ,一个比较简单的例子,具体可以去看文档
server end

```
# import required libraries
from vidgear.gears import VideoGear
from vidgear.gears import NetGear

# open any valid video stream(for e.g `test.mp4` file)
stream = VideoGear(source="test.mp4").start()

# Define Netgear Server with default parameters
server = NetGear()

# loop over until KeyBoard Interrupted
while True:

try:

# read frames from stream
frame = stream.read()

# check for frame if Nonetype
if frame is None:
break

# {do something with the frame here}

# send frame to server
server.send(frame)

except KeyboardInterrupt:
break

# safely close video stream
stream.stop()

# safely close server
server.close()
```

client end

```
# import required libraries
from vidgear.gears import NetGear
import cv2


# define Netgear Client with `receive_mode = True` and default parameter
client = NetGear(receive_mode=True)

# loop over
while True:

# receive frames from network
frame = client.recv()

# check for received frame if Nonetype
if frame is None:
break

# {do something with the frame here}

# Show output window
cv2.imshow("Output Frame", frame)

# check for 'q' key if pressed
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break

# close output window
cv2.destroyAllWindows()

# safely close client
client.close()
```
2024-08-02 13:55:08 +08:00
回复了 Haku 创建的主题 Python Python 中如何在内存中优雅地提取视频帧?
不过实际上还是会在本地创建文件,video capture 本身不支持直接从 memory 中读取,如果是自己控制数据流,用一个迭代器或者生成器把每一帧转 cv mat 就可以
2024-08-02 13:51:33 +08:00
回复了 Haku 创建的主题 Python Python 中如何在内存中优雅地提取视频帧?
@Haku 如果只是希望在内存中方便读取,使用 tmpfile import tempfile
import cv2

my_video_bytes = download_video_in_memory()

with tempfile.NamedTemporaryFile() as temp:
temp.write(my_video_bytes)

video_stream = cv2.VideoCapture(temp.name)

# do your stuff.
2024-08-02 10:34:03 +08:00
回复了 Haku 创建的主题 Python Python 中如何在内存中优雅地提取视频帧?
@stebest 挺简单的,给个示例吧 import numpy as np
import cv2 as cv
import io

image_stream = io.BytesIO()
image_stream.write(connection.read(image_len))
image_stream.seek(0)
file_bytes = np.asarray(bytearray(image_stream.read()), dtype=np.uint8)
img = cv.imdecode(file_bytes, cv.IMREAD_COLOR)
2024-08-02 10:31:08 +08:00
回复了 Haku 创建的主题 Python Python 中如何在内存中优雅地提取视频帧?
额,这个倒是跟视频没啥关系,不就是想用 bytesIO 嘛。
2022-09-27 10:50:06 +08:00
回复了 stebest 创建的主题 求职 虚拟人系统研发实习生招聘
@kizunai 不是 hh ,你有兴趣也可以做一个
1  2  3  4  5  6  7  8  9  10 ... 34  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2654 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 03:41 · PVG 11:41 · LAX 20:41 · JFK 23:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.