aifeifei's picture

aifeifei PRO

aifeifei798

AI & ML interests

roleplay aifeifei

Recent Activity

Organizations

Hugging Face Discord Community's profile picture

aifeifei798's activity

posted an update about 1 hour ago
view post
Post
55
😊 This program is designed to remove emojis from a given text. It uses a regular expression (regex) pattern to match and replace emojis with an empty string, effectively removing them from the text. The pattern includes a range of Unicode characters that correspond to various types of emojis, such as emoticons, symbols, and flags. By using this program, you can clean up text data by removing any emojis that may be present, which can be useful for text processing, analysis, or other applications where emojis are not desired. 💻
import re

def remove_emojis(text):
    # Define a function to remove emojis from a given text
    emoji_pattern = re.compile(
        "["
        u"\U0001F600-\U0001F64F"  # emoticons, such as smiling faces
        u"\U0001F300-\U0001F5FF"  # symbols and pictographs, like stars and hearts
        u"\U0001F680-\U0001F6FF"  # transport and map symbols, like cars and airplanes
        u"\U0001F1E0-\U0001F1FF"  # flags, like country flags
        u"\U00002702-\U000027B0"
        u"\U000024C2-\U0001F251"
        "]+", flags=re.UNICODE
    )
    # Use the compiled pattern to replace emojis with an empty string
    return emoji_pattern.sub(r'', text)
New activity in aifeifei798/big-boobs-clothed about 10 hours ago

Add generated example

1
#2 opened about 10 hours ago by
aifeifei798

Update README.md

#1 opened about 10 hours ago by
aifeifei798
published an article 2 days ago
posted an update 3 days ago
view post
Post
1066
一个加入水印的小程序
from PIL import Image, ImageDraw, ImageFont

def add_watermark(image):
    watermark_text = "AI Generated by DarkIdol FeiFei"

    # Ensure the input is an Image object
    if not isinstance(image, Image.Image):
        raise ValueError("Input must be a PIL Image object")

    width, height = image.size

    # Create a drawing object to draw on the image
    draw = ImageDraw.Draw(image)

    # Set the font size for the watermark text
    font_size = 10  # Set font size to 10
    try:
        # Try to use a common font file
        font = ImageFont.truetype("Iansui-Regular.ttf", font_size)
    except IOError:
        # Use the default font if the specified font file is not found
        font = ImageFont.load_default()

    # Calculate the width and height of the watermark text using textbbox
    bbox = draw.textbbox((0, 0), watermark_text, font=font)
    text_width = bbox[2] - bbox[0]
    text_height = bbox[3] - bbox[1]

    # Calculate the position for the watermark text (bottom-right corner)
    x = width - text_width - 10  # 10 is the right margin
    y = height - text_height - 10  # 10 is the bottom margin

    # Add the watermark text to the image
    draw.text((x, y), watermark_text, font=font, fill=(255, 255, 255, 128))

    # Return the modified image object
    return image

- 字体从https://fonts.google.com去找就可以了,程序都标注清楚了,自行修改
  • 1 reply
·
updated a collection 4 days ago
upvoted an article 5 days ago
view article
Article

SmolVLM Grows Smaller – Introducing the 250M & 500M Models!

155
published an article 5 days ago