https://github.com/anthropics/anthropic-cookbook
read_web_pages_with_haiku.ipynb: PythonでAnthropicのClaude APIを使用してWebページのコンテンツを要約する方法を説明しています。
| export const hello = () => { | |
| console.log('hello') | |
| } |
| ## https://huggingface.co/oshizo/japanese-sexual-moderation-v2 | |
| ## How to use | |
| ## $ python3 -m venv venv && source venv/bin/activate | |
| ## $ pip install transformers torch sentencepiece | |
| ## $ python main.py --input "富士山は日本で一番高い山です。" | |
| import torch | |
| import argparse | |
| from transformers import AutoModelForSequenceClassification, AutoTokenizer |
https://github.com/anthropics/anthropic-cookbook
read_web_pages_with_haiku.ipynb: PythonでAnthropicのClaude APIを使用してWebページのコンテンツを要約する方法を説明しています。
| #!/usr/bin/env zsh | |
| # Default settings | |
| HOST="127.0.0.1" | |
| PORT="10101" | |
| SPEAKER="888753760" # Default speaker ID (Anneli - ノーマル) | |
| TEXT="" | |
| # Get the script name without any prefix | |
| SCRIPT_NAME=$(basename "$0") |
| from typing_extensions import TypedDict, Literal | |
| import random | |
| from langgraph.graph import StateGraph, START | |
| from langgraph.types import Command | |
| # Define graph state | |
| class State(TypedDict): | |
| foo: str | |
| # Define the nodes |
| import contextlib | |
| import wave | |
| import logging | |
| import asyncio | |
| import os | |
| import sounddevice as sd | |
| import soundfile as sf | |
| from google import genai | |
| # ロガーの設定 |
| import re | |
| from bs4 import BeautifulSoup | |
| import json | |
| def extract_rss_urls(html_file): | |
| with open(html_file, 'r', encoding='utf-8') as f: | |
| html_content = f.read() | |
| soup = BeautifulSoup(html_content, 'html.parser') |
| import email | |
| import os | |
| from email import policy | |
| from email.parser import BytesParser | |
| def extract_email_content(eml_file): | |
| """Extract plain text content from email file.""" | |
| with open(eml_file, 'rb') as f: | |
| msg = BytesParser(policy=policy.default).parse(f) | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from torchvision import datasets, transforms | |
| class ConvNet(nn.Module): | |
| def __init__(self): | |
| super(ConvNet, self).__init__() | |
| # 畳み込み層 | |
| self.conv1 = nn.Conv2d(1, 32, 3, padding=1) |