This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import google.generativeaimport argparse | |
import google.generativeai as genai | |
import os | |
from PIL import Image | |
import pyheif | |
def load_image(image_path): | |
""" | |
Loads an image from a file, discerning the format by its extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import glob | |
from collections import defaultdict | |
import os | |
def analyze_files(file_glob, limit): | |
""" | |
Analyzes a collection of text files to find duplicate sentences and calculate | |
potential deduplication savings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import spacy | |
from spacy.language import Language | |
def create_ner_model(): | |
"""Create and return a spaCy model with rule-based NER for Chinese food entities.""" | |
# Define entity lists | |
fruits = [ | |
'苹果', '香蕉', '橘子', '橙子', '葡萄', '草莓', '芒果', '西瓜', | |
'菠萝', '梨', '桃子', '柠檬', '樱桃', '猕猴桃', '石榴', '椰子', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
def compare_scripts(original_file: str, modified_file: str): | |
""" | |
Compares two Python scripts to ensure every line from the original | |
exists in the modified version. | |
The comparison ignores empty lines and leading/trailing whitespace | |
to focus on the core code content. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import markdown | |
import os | |
import re | |
from langchain_google_genai import ChatGoogleGenerativeAI | |
from langchain.prompts import ChatPromptTemplate | |
from langchain.schema.output_parser import StrOutputParser | |
# --- Style Generation and Validation (Updated with LangChain) --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import markdown | |
import os | |
def create_html_from_markdown(input_files, output_file): | |
""" | |
Converts a list of markdown recipe files into a single HTML file. | |
Args: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cli_app.py | |
import argparse | |
from datetime import datetime | |
# Import the concrete FlatFileStore, as CLI app is responsible for choosing the implementation | |
from flat_file_store import FlatFileStore | |
from todo_manager import TodoManager | |
def main(): | |
""" | |
Main function to parse arguments and execute Todo DSL commands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cli_app.py | |
import argparse | |
from datetime import datetime | |
from flat_file_store import FlatFileStore | |
from todo_manager import TodoManager | |
def main(): | |
""" | |
Main function to parse arguments and execute Todo DSL commands. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flat_file_store.py | |
import json | |
import os | |
class FlatFileStore: | |
""" | |
A simple flat-file storage class for Todo items. | |
It reads and writes todo data to a JSON file. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect, useRef } from 'react'; | |
// Main App component for Jon's Podcast Creator | |
const App = () => { | |
// State for the podcast topic input by the user | |
const [topic, setTopic] = useState(''); | |
// State for the generated podcast transcript | |
const [transcript, setTranscript] = useState(''); | |
// State to manage loading status during AI generation | |
const [isLoading, setIsLoading] = useState(false); |
NewerOlder