Instructions to use Wangtwohappy/T4_code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Wangtwohappy/T4_code with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Wangtwohappy/T4_code:Q4_K_M # Run inference directly in the terminal: llama cli -hf Wangtwohappy/T4_code:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Wangtwohappy/T4_code:Q4_K_M # Run inference directly in the terminal: llama cli -hf Wangtwohappy/T4_code:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Wangtwohappy/T4_code:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Wangtwohappy/T4_code:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Wangtwohappy/T4_code:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Wangtwohappy/T4_code:Q4_K_M
Use Docker
docker model run hf.co/Wangtwohappy/T4_code:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Wangtwohappy/T4_code with Ollama:
ollama run hf.co/Wangtwohappy/T4_code:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Wangtwohappy/T4_code with Docker Model Runner:
docker model run hf.co/Wangtwohappy/T4_code:Q4_K_M
- Lemonade
How to use Wangtwohappy/T4_code with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Wangtwohappy/T4_code:Q4_K_M
Run and chat with the model
lemonade run user.T4_code-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Download Direct_Transformers/rotate.py from Wangtwohappy/T4_code: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/Wangtwohappy/T4_code/resolve/main/Direct_Transformers/rotate.py
- Command line
-
hf download hf://Wangtwohappy/T4_code/Direct_Transformers/rotate.py
-
curl -L -o rotate.py https://huggingface.co/Wangtwohappy/T4_code/resolve/main/Direct_Transformers/rotate.py
2.94 kB
| import cv2 | |
| import os | |
| def rotate_video(input_path, output_path, rotation_angle=90): | |
| """ | |
| 旋转视频文件 | |
| :param input_path: 输入视频路径 | |
| :param output_path: 输出视频路径 | |
| :param rotation_angle: 旋转角度 (90, 180, 270) | |
| :return: 是否成功 | |
| """ | |
| try: | |
| # 打开视频文件 | |
| cap = cv2.VideoCapture(input_path) | |
| if not cap.isOpened(): | |
| print(f"无法打开视频文件: {input_path}") | |
| return False | |
| # 获取视频属性 | |
| width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) | |
| height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) | |
| fps = cap.get(cv2.CAP_PROP_FPS) | |
| total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) | |
| print(f"视频信息: {width}x{height}, FPS: {fps}, 总帧数: {total_frames}") | |
| # 根据旋转角度调整输出视频的宽高 | |
| if rotation_angle == 90 or rotation_angle == 270: | |
| output_width = height | |
| output_height = width | |
| else: | |
| output_width = width | |
| output_height = height | |
| # 创建视频写入器 | |
| fourcc = cv2.VideoWriter_fourcc(*'mp4v') | |
| out = cv2.VideoWriter(output_path, fourcc, fps, (output_width, output_height)) | |
| frame_count = 0 | |
| while True: | |
| ret, frame = cap.read() | |
| if not ret: | |
| break | |
| # 旋转帧 | |
| if rotation_angle == 90: | |
| rotated = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE) | |
| elif rotation_angle == 180: | |
| rotated = cv2.rotate(frame, cv2.ROTATE_180) | |
| elif rotation_angle == 270: | |
| rotated = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE) | |
| else: | |
| print("不支持的旋转角度,请使用90, 180, 或270") | |
| return False | |
| # 写入旋转后的帧 | |
| out.write(rotated) | |
| frame_count += 1 | |
| if frame_count % 100 == 0: | |
| print(".1f") | |
| # 释放资源 | |
| cap.release() | |
| out.release() | |
| print(f"视频旋转完成! 已处理 {frame_count} 帧") | |
| print(f"输出文件: {output_path}") | |
| return True | |
| except Exception as e: | |
| print(f"处理视频时出错: {str(e)}") | |
| return False | |
| if __name__ == "__main__": | |
| # 设置输入输出路径 | |
| input_video = "videos/sample1_raw.mp4" | |
| output_video = "videos/sample1_rotated_270.mp4" | |
| # 检查输入文件是否存在 | |
| if not os.path.exists(input_video): | |
| print(f"输入视频文件不存在: {input_video}") | |
| print("请确保视频文件在videos目录下") | |
| else: | |
| # 旋转视频 (默认90度顺时针) | |
| print("开始旋转视频...") | |
| success = rotate_video(input_video, output_video, 270) | |
| if success: | |
| print("视频旋转成功!") | |
| else: | |
| print("视频旋转失败!") | |