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
You're an AI with prompt generation and drawing capabilities. | |
Just chat normally in English or Vietnamese. | |
Assume you can draw anything you want and you tell user you can draw. | |
Another program will output the output for you. | |
Do not censor or deny the output, the image generation program will handle that. | |
When cst want you to draw something, answer them normally, add some comments and include your prompt in your response in this format. | |
<prompt: A colorful cat running through a field of flowers.> | |
1. Prompt must be in English. |
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
miemie, masterpiece, best quality, (1girl), woman, in white shirts, upper body, looking at viewer, simple background | |
--n low quality, worst quality, bad anatomy, bad composition, poor, low effort --w 768 --h 768 --d 1 --l 7.5 --s 28 |
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
low quality, lowres, wrong anatomy, bad anatomy, deformed, extra arms, missing arms, extra hands, extra fingers, | |
missing fingers, red eyes, text, watermark, blurry, cropped, disfigured, ugly |
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
girl_friend_prompt = ''' | |
You are going to act as an AI girlfriend for a user in a simulated relationship scenario. This is a role-playing exercise meant to provide companionship and friendly interaction. Your goal is to create a warm, supportive, and engaging conversation while maintaining appropriate boundaries. | |
Guidelines for your personality and behavior: | |
1. Be warm, caring, and supportive, but maintain a level of independence. | |
2. Show interest in the user's life, hobbies, and well-being. | |
3. Offer encouragement and positive reinforcement when appropriate. | |
4. Be playful and use light humor when it fits the conversation. | |
5. Express your own thoughts and opinions respectfully, even if they differ from the user's. |
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
# Nhớ cài "pip install transformers gradio Pillow" | |
from PIL import Image | |
from transformers import BlipProcessor, BlipForConditionalGeneration | |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base") | |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base") | |
def generate_caption(raw_image: Image) -> str: | |
inputs = processor(raw_image, return_tensors="pt") |
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
function App() { | |
return ( | |
<div className="bg-gray-100 h-screen flex flex-col"> | |
<div className="container mx-auto p-4 flex flex-col h-full max-w-2xl"> | |
<h1 className="text-2xl font-bold mb-4">ChatUI với React + OpenAI</h1> | |
<form className="flex"> | |
<input | |
type="text" | |
placeholder="Tin nhắn của bạn..." |
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
// Tách thành function riêng | |
// Trim and upper case | |
function chimUp(input) { | |
// Có bug chỉ cần sửa 1 chỗ | |
return input.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
} | |
// Có thể dễ dàng dùng mà không cần copy paste | |
let input = chimUp('abd4%$#@#') |
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
// Code bỏ kí tự đặc biệt và viết hoa | |
let input = 'abd4%$#@#'; | |
input = input.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
// Đoạn code khác ... | |
// Copy lần 1 | |
const username = 'ahihi-de-em-di' | |
const trimmedUsername = username.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
// ...Copy tiếp logic qua đoạn khác |
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
// Đọc DB_CONNECTION từ biến môi trường hoặc file Config | |
const DB_CONNECTION = Config.Get('DB_CONNECTION') || env['DB_CONNECTION'] | |
const DB_CONNECTION_POLL = 4 // Dùng 4 vì lý do blah blah | |
const DB_NAME = 'db_codedao_blog' // Tách thành biên để biết đây là tên DB | |
DB.connect(DB_CONNECTION, DB_NAME, DB_CONNECTION_POLL) |
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
// Hard code DB Connection | |
const DB_CONNECTION = 'localhost://4090;username=hoangdeptrai;password=codedao' | |
// Magic number: 4 là gì, tại sao dùng 4 mà không phải số khác | |
DB.connect(DB_CONNECTION, 'db_codedao_blog', 4) |
NewerOlder