Month: February 2023

  • วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1]

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1]

    บทความนี้ก็เป็นการฉลอง Section ใหม่ของเว็บเทพเอ็กเซล นั่นก็คือ บทความเกี่ยวกับ AI นั่นเอง เพราะตอนนี้เทคโนโลยี AI กำลังมาแรงมากๆ (ทั้ง AI วาดรูป และ ChatGPT) ใครที่พลาดไม่ทันศึกษาอาจตกยุคหรืออาจถูกหลอกได้เลยนะ ดังนั้นใครไม่อยากพลาดความรู้ดีๆ ต้องรีบศึกษาแล้ว และไม่ช้า AI จะเข้ามาอยู่ในโปรแกรมทั่วไปอย่าง Excel มากขึ้นแน่นอน

    เอาล่ะ เข้าเรื่อง AI วาดรูปล่ะ แม้ว่าก่อนหน้านี้ผมได้เคยเขียนบทความเกี่ยวกับการใช้งาน AI วาดรูป ตัวที่ชื่อว่า MidJourney ไปแล้ว ซึ่งมันจะเป็น AI วาดรูปที่ทรงพลังมากๆ ตัวนึง แต่ข้อเสียหลักๆ ที่ผมเจอก็คือ มันไม่สามารถ Customize ผลลัพธ์ได้ตามที่เราต้องการมากนัก (หรือได้ก็ต้องใช้ความพยายามมากๆ) ที่สำคัญคือ เราไม่สามารถเลือก Model การวาดรูปในแบบที่เราต้องการเป๊ะๆ ได้ ต้องใช้ Model ที่ Midjourney เตรียมไว้ให้เท่านั้น ซึ่งมีแค่ไม่กี่แบบ และอีกอย่างก็คือมันเสียค่าใช้จ่ายรายเดือนที่ค่อนข้างสูงเลยทีเดียว (เดือนละ 30 USD)

    ในวันนี้ผมก็เลยมาแนะนำเครื่องมืออีกตัวนึง ชื่อว่า Stable Diffusion ซึ่งผมไปซุ่มหัดใช้งานมันมาประมาณ 1 week เต็มๆ ก็พอใช้งานมันได้ดีใช้ได้แล้วล่ะ ใช้ยากกว่า Midjourney นิดหน่อย แต่มีข้อดีมากมาย เลยจะมาแชร์ความรู้ให้ทุกคนรู้ด้วยครับ ^^

    ซึ่ง Stable Diffusion เนี่ย ข้อดีที่ผมเห็นคือ

    • ทำรูปได้หลากหลายสไตล์ ทั้งภาพสมจริงและการ์ตูน
    • มี Model ให้เลือกมากมาย โหลดเพิ่มเสริมได้ แถมผสม Model เองได้อีก
    • มัน Customize ภาพผลลัพธ์ได้ละเอียดมากๆ ถึงขนาดที่สามารถกำหนดหน้าตา ท่าทาง ชุด สถานที่ได้ทั้งหมด
    • มีเครื่องมือเสริมและ Community เยอะแยะ ที่ช่วยให้การ Gen รูปง่ายขึ้นสะดวกขึ้น
    • ที่สำคัญคือมันฟรี!! (บ้าไปแล้ววว)

    ตัวอย่างรูปที่สร้างจาก AI ที่สร้างจากเครื่องมือ Stable Diffusion ซึ่งดูผ่านๆ อาจคิดว่าคนจริงก็ได้นะ

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 1
    Screenshot จาก Post ของเพจ https://www.facebook.com/AiAngelGallery

    Stable Diffusion คืออะไร?

    Stable Diffusion คือ Machine Learning Model (AI) ที่สามารถเปลี่ยนข้อความที่เราป้อน ให้กลายเป็นรูปภาพตามที่เราสั่งได้ (ถ้าใครสนใจหลักการทางเทคนิคของเจ้า AI ตัวนี้ ไว้อนาคตจะมาลองสรุปให้ฟัง)

    โดยที่มันถูกปล่อย Code และ Model ออกมาให้คนทั่วไปใช้ฟรี โดยปล่อยมาแบบ Open Source เลย แถมยอมให้คนเอาไปต่อยอดได้อีกไม่รู้จบ

    ทำให้ตอนนี้ Stable Diffusion มาแรงมากๆ และมีเครื่องมือเสริมและการใช้งานให้เลือกได้มากมายแต็มไปหมด (แม้แต่ Midjourney ก็เอา Model ของ Stable Diffusion ไปผสมผสานนะ ตอนหลังๆ รูปใน MJ เลยสวยขึ้นมากๆ)

    ความดีงามสุดๆ ของ Stable Diffusion คือมี Community ขั้นสุดยอดที่มี Model ใหม่ๆ เจ๋งๆ โผล่มาเพียบ ที่โดดเด่นที่สุดคือเว็บนี้ https://civitai.com/ ซึ่งจะขอแนะนำโดยละเอียดภายหลัง

    • ต้องชี้แจงว่าในเว็บนี้หลายๆ Model เป็น 18+ นะ แต่มันจะแบ่งประเภทชัดเจน แล้วเรา Filter เลือกได้ว่าจะแสดงเฉพาะ Model แบบไหนที่เราสนใจได้ครับ
    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 2

    อย่างไรก็ตามจะใช้ Model ข้างบนพวกนี้ได้ จะต้องเลือกใช้วิธีการใช้งาน Stable Diffusion ที่รองรับการเพิ่ม Model แบบ Custom ได้ด้วย

    วิธีการใช้งาน Stable Diffusion

    การจะใช้งาน Stable Diffusion ได้เนี่ย มันมีหลายวิธี แต่ผมจะขอแนะนำ 4 วิธีแล้วกันครับ

    ใช้ผ่าน Website ที่เค้าออกแบบมาให้ User ปกติใช้งานง่ายๆ

    ข้อดีคือใช้งานง่ายสุดๆ แต่ข้อเสียก็คือ ปรับแต่งมากไม่ได้ ใช้ model customize แบบที่ตัวเองชอบไม่ได้

    • https://stablediffusionweb.com/ แค่เข้าไปลองพิมพ์ prompt ก็ใช้ได้เลย ไม่ต้อง install อะไรเลยทั้งสิ้น แต่ข้อเสียคือปรับแต่งอะไรแทบไม่ได้เลย คือมี Advanced Option ที่ปรับอะไรได้น้อยมากๆ เลือก Model มาใช้ก็ไม่ได้ (ลองเข้าไปกดเล่นดูได้)
    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 3
    • https://beta.dreamstudio.ai/dream ตัวนี้มีลูกเล่นเยอะขึ้นมาหน่อย แต่ก็เลือก Model Custom เองไม่ได้ และสุดท้ายใช้ไปเรื่อยๆ Credit จะหมด คือต้องเสียเงินอยู่ดี (ตัวนี้จะคล้ายๆ Midjourney)
    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 4

    ลงโปรแกรมในเครื่องตัวเองไปเลย (Local Machine)

    วิธีนี้ยืดหยุ่นสุดๆ ทรงพลังสุดๆ (ถ้าเครื่องแรง คือมีการ์ดจอ GPU ที่ดีพอ) และฟรีด้วย แต่ข้อเสียคือขั้นตอนจะยุ่งยากที่สุด เพราะต้องลงโปรแกรมในเครื่องตัวเองด้วย (ผมเองใช้วิธีนี้ครับ เดี๋ยวจะบอกวิธีลงให้ใน Section ถัดไป)

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 5

    แต่ข้อเสียสำคัญของวิธีนี้ที่หลายคนจะติดก็คือ Computer ที่เราใช้ควรมีการ์ดจอที่ดีพอ (ไม่งั้นมันจะรันไม่ไหว) และควรมี Harddisk ที่ความจุเยอะๆ ด้วย (เพราะอาจต้องเก็บ Model หลายๆ ตัวไว้ใช้ แต่เรื่อง Harddisk ยังไม่จำเป็นเท่า GPU การ์ดจอ)

    ป.ล. ผมเองใช้ Computer Gaming ที่มี GPU แยก ยิ่ง GPU มี VRAM เยอะๆ จะยิ่งดี ถ้าต่ำกว่า 8 GB จะทำอะไรลำบากแล้ว

    ใช้ผ่าน Google Collab

    อันนี้เหมาะกับคนที่อยากจะ Customize ได้เยอะๆ แต่ไม่มีคอมพ์ส่วนตัวที่ GPU (การ์ดจอ) ดีพอ แถมรันผ่านมือถือก็ได้ด้วย ซึ่งถ้าจะใช้ Google Colab ก็จะมีให้เลือกหลายตัว (แล้วแต่ว่าเราจะใช้ code ของใครมารัน Stable Diffusion)

    –ใช้ฟรี แต่ถ้าโควตาหมดต้องรอ reset หรือไม่ก็เสียตังเพื่อใช้ Colab Pro ซึ่งก็ต้องเสียตังอีก

    วิธีการใช้งานพวกนี้คือต้องรัน Cell ที่เก็บ code Python เอาไว้

    ตัวมาตรฐาน จาก Stability.ai : https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb

    ตัวยอดนิยม web ui ของ camenduru (แนะนำ)
    แบบไม่ลง drive : https://github.com/camenduru/stable-diffusion-webui-colab
    แบบลง drive : https://github.com/camenduru/stable-diffusion-webui-colab/tree/drive (แนะนำ)
    Tutorial : https://www.youtube.com/watch?v=lGco45e9o5Y

    ตัวยอดนิยม webui ของ Linaqruf (แนะนำ)
    https://github.com/Linaqruf/sd-notebook-collection

    ตัวยอดนิยม web ui ของ nolanaatama (แนะนำ)
    https://github.com/nolanaatama/sd-1click-colab
    Tutorial : https://www.youtube.com/@nolanaatama/videos

    ตัวปรับใช้ง่ายของ TheLastBen : (วิธีการใช้)
    https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

    ตัวที่ปรับแต่งหน้าตาให้ใช้งานง่าย โดย Altryne : https://colab.research.google.com/github/altryne/sd-webui-colab/blob/main/Stable_Diffusion_WebUi_Altryne.ipynb

    ใช้ผ่าน Mobile App ชื่อ Draw Things

    ในมือถือ/ipad/Mac จะมี App ชื่อ Draw Things ซึ่งเป็นโปรแกรมที่ทำดีมากเลย ใช้ง่าย และ Customize ได้เยอะ แต่ควรใช้ในอุปกรณ์ที่แรงพอ เช่น iPad Pro หรืออะไรพวกนี้ เพราะถ้ารันในมือถือจะช้าพอสมควร หรืออาจจะรันไม่ผ่านด้วยซ้ำ (วิธีการใช้งาน)

    ข้อดีคือ ตัวนี้สามารถโหลด Model และ Textual Inversion จากแหล่งอื่นมาใช้ได้ (เช่น Civitai ) ส่วนข้อเสียคือ ตอนนี้ยังไม่สามารถใช้ LoRA ได้ และน่าจะทำให้เครื่องมือถือหรือ Ipad ทำงานหนักมาก ไม่แน่ใจว่าระยะยาวจะส่งผลเสียแค่ไหน

    ตกลงแล้วลงโปรแกรมแบบไหนดี?

    โดยสรุป คือ ไม่มีวิธีไหนที่ทำได้ง่ายๆ ฟรีๆ แบบถาวรหรือครับ เพราะแบบที่บอกว่าลงเครื่องตัวเองแล้วฟรี ยังไงก็ต้องใช้เงินซื้อการ์ดจออยู่ดีนะ (การ์ดจอดีๆ ก็หลายหมื่นอยู่ครับ) หรือจะใช้ App Draw Things คุณก็ต้องมี Tablet แรงๆ อย่าง iPad ไม่งั้นก็ไม่ไหว ซึ่งบางทีแพงกว่าคอมพ์อีก 555 หรือแม้แต่ Google Colab ในที่สุดก็จะโควต้าหมดจนต่างจ่ายเงิน

    ดังนั้นทุกอย่างมี cost ของมันนะ อันนี้ต้องทำใจ

    • ถ้าให้แนะนำคือ หากมีเครื่องคอมพ์ดีๆ GPU แรงๆ ให้ลงในเครื่องตัวเองครับ เจ๋งสุด
    • ถ้าไม่มีคอมพ์แรงๆ แนะนำให้ใช้ Google Colab จะยืดหยุ่นเหมือนลงเครื่องตัวเองด้วย
    • ถ้าใช้ Colab แล้วยากไป ให้ใช้ Draw Things ผ่าน ipad/mac

    ทั้งหมดนี้คือความเห็นส่วนตัวครับ

    งั้นต่อจากนี้ผมจะอธิบายวิธีที่ยืดหยุ่นสุด และเป็นวิธีที่ผมใช้จริง คือ ลงโปรแกรมในคอมพ์ตัวเองนะครับ

    วิธีใช้งาน Stable Diffusion แบบลงในเครื่องคอมพ์ตัวเอง

    สำหรับวิธีที่จะลง Stable Diffusion ในคอมพ์ตัวเอง (ซึ่งต้องมี GPU การ์ดจอที่ดีพอด้วย) แบบที่นิยมมากที่สุด คือใช้ผ่านเครื่องมือที่เรียกว่า Automatic 1111 Stable Diffusion Web UI (เพราะเค้าเขียนโปรแกรมให้สั่งงาน Stable Diffusion แบบใช้ง่ายให้เราแล้ว) ซึ่งในเว็บนั้นจะมีทั้งไฟล์ประกอบที่ต้องใช้ และมีขั้นตอนการลงโปรแกรมทั้งหมดให้ด้วย

    คลิปประกอบวิธีการลงโปรแกรม

    วิธีที่แนะนำ

    วิธีนี้เราต้องลงโปรแกรม Python และโปรแกรม Git (แบบ install ปกติ ไม่ใช่ portable) ก่อน แล้วค่อยโหลดเจ้า Automatic 1111 อีกที ซึ่งวิธีทำตามคลิปได้เลย

    ที่สำคัญห้ามลืมคือ ตอนกด Install ต้องติ๊กเลือก “Add Python to PATH”

    วิธีคนขี้เกียจ

    วิธีนี้แค่โหลดไฟล์ zip มาแล้วรันไฟล์ที่กำหนดแล้วรอ โดยไม่ต้องลง python กับ git เลยด้วยซ้ำ (มันจะโหลดให้เอง) อย่างไรก็ตามในระยะยาวผมไม่แน่นใจว่าจะมีปัญหาอะไรหรือไม่ ดังนั้นให้ใช้ในฐานะวิธีสำรองแล้วกัน

    สำหรับเครื่อง Mac อาจมีบางอย่างต่างไปเช่นกัน ลองดูในนี้น่าจะดีกว่า

    ขั้นตอนการลงโปรแกรม (เท่าที่จำเป็น)

    เครื่องผมเป็นการ์ดจอที่มี GPU Nvidia นะครับ สำหรับคนที่ใช้การ์ดจอ AMD อาจต้องมีการลงโปรแกรมที่ต่างออกไปเล็กน้อย เช่น Link นี้, Link นี้

    • ต้องลงโปรแกรม Python (3.10.x)
      • สำคัญคือ ตอนกด Install Python ต้องติ๊กเลือก “Add Python to PATH”
    • ลงโปรแกรม Git (แบบ install ปกติ ไม่ใช่ portable) ซึ่ง Next รัวๆ ได้
    • สร้าง Folder ที่ต้องการ เช่น MySDFolder จากนั้นเข้าไปใน Folder
    • เข้าไปใน navigation bar แล้ว Click ซ้าย 1 ทีแล้วพิมพ์ cmd กด enter เพื่อเข้า cmd prompt (อย่าเพิ่งช๊อค ทำตามไปก่อน 555)
      วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 8

    พิมพ์ใน cmd prompt ตามนี้ (ใช้ copy paste เอาได้) แล้วกด Enter

    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

    โปรแกรมจะโหลดไฟล์จาก AUTOMATIC1111/stable-diffusion ที่เรากำหนด

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 9

    ขั้นตอนการโหลด Model

    ขั้นตอนนี้ข้ามได้ ถ้าเราไม่ได้โหลด Model อะไรเลย เดี๋ยวโปรแกรมมันโหลดให้เองตอนรัน webui-user.bat ที่อยู่ใน Folder ชื่อ stable-diffusion-webui

    บอกไว้ก่อนว่าเราสามารถโหลด Model จาก Civitai มาเพิ่มได้อีกครับ ซึ่งใครๆ ก็โหลด เพราะ Model พื้นฐานของ Stable Diffusion มัน Generate ได้ไม่สวยหรอก

    วิธีการ Run โปรแกรม Stable Diffusion Web UI

    หลังจากติดตั้งตามขั้นตอนข้างบนแล้ว ให้ดับเบิ้ลคลิ๊กเพื่อรันไฟล์ชื่อ webui-user.bat ที่อยู่ใน Folder ชื่อ stable-diffusion-webui (ที่โปรแกรมสร้างให้นอกสุด)

    ครั้งแรกจะมี Script อะไรโผล่มาเยอะแยะ (อย่าเพิ่งช๊อค) และจะรันนานหน่อย (ครั้งถัดไปจะเร็วขึ้น)

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 10

    ให้รอจนมันขึ้น

    Running on local URL:  http://127.0.0.1:7860
    
    To create a public link, set `share=True` in `launch()`.

    แบบนี้ถือว่า Install จบแล้ว

    ลองใช้งานครั้งแรก

    แนะนำให้คลิ๊ขวา Edit ไฟล์ web user-ui.bat โดยเพิ่ม parameter

    • –autolaunch เอาไว้ทำให้รันแล้วไม่ต้องไปคลิ๊ก URL เอง ก็สะดวกดี
    • –xformers สำหรับคนที่มีการ์ดจอ Nvidia ที่ไม่ได้เก่าเกินไปตรงนี้เข้าไป จะช่วยให้ Generate เร็วขึ้นพอสมควรเลยครับ
    set COMMANDLINE_ARGS=--xformers --autolaunch

    หลังจากลงโปรแกรมเสร็จ ให้เรารันไฟล์ web user-ui.bat แล้วถ้ามันเข้าหน้าเว็บเลยก็ ok แต่ถ้ามันขึ้นจอดำๆ อย่างเดียว ก็ให้ กดปุ่ม Ctrl ค้าง แล้วคลิ๊กซ้ายไปที่ URL http://127.0.0.1:7860 ได้เลย มันจะเปิด Stable Diffusion Web UI ขึ้นมา ซึ่งนี่แหละคือหน้าจอโปรแกรมที่เราจะใช้

    ทีนี้เพื่อเป็นการฉลองการติดตั้งโปรแกรม เราจะลอง Generate รูปขึ้นมาซักอัน (โดยไม่ต้องแก้ค่า Setting อะไรทั้งสิ้น) ด้วยคำว่า

    Siamese cat waling on a beach

    แล้วกัน โดยพิมพ์เข้าไปใน Image Prompt ในส่วนของ Tab ที่เขียนว่า txt2img แล้วกดปุ่ม Generate ปุ่มส้มๆ ที่ด้านขวาเลย

    เท่านี้มันก็จะสร้่างรูปแมวไทยเดินบนชายหาดขึ้นมา ถ้าขึ้นรูปมาแสดงว่าสำเร็จแล้ว (รูปของคุณอาจไม่เหมือนของผม เพราะมันยังมีการใช้ Seed แบบ Random อยู่)

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 11

    ถ้าใครทำให้รูปขึ้นมาได้ถือว่าสำเร็จ! ยินดีด้วย ตอนนี้คุณลง Stable Diffusion ในเครื่องตัวเองได้แล้วล่ะ

    คราวนี้เราลองมาให้มัน Generate รูปผู้หญิงไทยสวยๆ กัน ลองใส่ Prompt ว่า

    Beautiful Thai woman sitting in coffee shop

    เราจะพบว่าผลลัพธ์ที่ออกมา ก็เป็นรูปผู้หญิงไทยนั่งใน Coffee Shop นั่นแหละ แต่มันดูไม่เห็นสวยเลยซักนิด รูปดูไม่มีคุณภาพเลย (ถ้าเทียบกับ MidJourey นะ จะสวยกว่ามากๆ)

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 12
    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 13
    ทำไมออกมาธรรมดามากๆ

    ป.ล. รูปทุกอันที่ Gen ออกมาจะอยู่ใน Folder Outputs โดยอันโนมัตินะครับ

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 14

    ทำยังไงรูปถึงจะสวย?

    การที่รูปจะสวยหรือไม่นั้น ขึ้นอยู่กับหลายๆ อย่างพอสมควร มันไม่ใช่แค่ว่ามี Prompt ที่ดีแล้วรูปจะสวยได้ตามต้องการนะครับ

    ถ้าให้ผม List ปัจจัยที่จะทำให้รูปสวยออกมาก็จะมีดังนี้

    • ตัว Model หลักที่ใช้ : ตอนนี้เราใช้ Model มาตรฐาน คือ sd v1.4 ปกติเลย
    • ตัว Model เสริม เช่น Lora, Textual Inversion (ซึ่งตอนนี้เราไม่ได้ใช้เลย )
    • Text Prompt ที่ใส่เข้าไป : เป็นคำบรรยายว่าเราต้องการรูปอะไร เข่น ต้องอธิบายตัวละคร หรือ object ที่เราต้องการ ฉากหลัง แสง เทคนิคด้านศิลป์ต่างๆ มากมาย
    • Negative Prompt ที่ใส่เข้าไป : ว่าเราไม่ต้องการอะไรในรูป
    • Setting ต่างๆ ในหน้าจอ : ซึ่งเยอะมากๆ ตัวหลักๆ ที่มีผลมาก คือ Resolution ของรูป, Sampling method, Sampling steps, CFG Scales เป็นต้น
    • ส่วนเสริม Extension ต่างๆ เช่น ที่ดังมากๆ คือ ControlNet ที่เอาไว้ควบคุมท่าทาง รวมถึงพวก x/y/z plot ที่เอาไว้ทดสอบค่าต่างๆ ได้ว่าตั้งค่าเท่านี้ๆ ผลจะออกมายังไง
    • โชค : ยังไงหลักการขอการ Gen รูป มันมีปัจจัยเรื่องการ Random อยู่ด้วย ยังไงต้องมีโชคบ้างนิดหน่อย (ถ้ามีความรู้มาก ก็ไม่จำเป็นต้องใช้โชคเยอะ)

    นอกจากนี้ยังมีเทคนิคการสั่ง AI อีกมากมาย เช่น นอกจากจะใช้ txt2img (text to image) แล้ว ยังมี img2img (image to image) ที่รองรับการ inpaint หรือให้ AI แก้เฉพาะจุดได้

    ทั้งหมดนี้ ผมจะสอนในบทความถัดไปนะครับ สำหรับตอนนี้ ผมจะ Generate ให้ดูว่า ถ้าเราตั้งค่าได้อย่างถูกต้อง (และมี Model หลักและเสริมครบถ้วน) การจะได้รูปผู้หญิงนั่งที่ร้านกาแฟจะออกมาเป็นยังไง?

    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 15
    วิธีใช้งาน AI สร้างรูปสุดเจ๋งและฟรีด้วย Stable Diffusion ฉบับมือใหม่ [ตอนที่1] 16
    นี่ครับ แม้จะยังไม่ Perfect แต่สวยขึ้นเยอะ

    ตอนต่อไป

    ดังนั้นใครอยากรู้วิธีเขียน Prompt, Model เจ๋งๆ รวมถึงวิธีตั้งค่าแต่ละอันโดยละเอียด ก็โปรดติดตามตอนต่อไปได้เลย รับรองสนุกแน่ครับ!

    รวมบทความ Stable Diffusion

    • 10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง

      10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง

      ในบทความนี้ผมจะมาแนะนำ 10 ไอเดียเด็ด วิธีใช้ ChatGPT ช่วยให้เราเก่ง Excel โดยใช้เจ้า AI ที่ดังสุดๆ ในตอนนี้อย่าง ChatGPT มาช่วย พร้อมตัวอย่างของแต่ละไอเดียครับ

      ChatGPT คืออะไร?

      สำหรับคนที่ยังไม่รู้จักนะ ChatGPT เป็น AI (Artificial Intelligence) ด้านภาษาขั้นสูงที่พัฒนาโดย OpenAI เป็นเครื่องมืออัน ทรงพลังสำหรับการ Chat ด้วยลักษะของข้อความ ซึ่งสามารถตอบคำถามและให้คำแนะนำได้หลากหลาย

      ChatGPT ได้รับการฝึกฝนเกี่ยวกับคลังข้อมูลข้อความจำนวนมหาศาลจากอินเทอร์เน็ต ทำให้สามารถทำความเข้าใจและสร้างข้อความในรูปแบบต่างๆ มากมาย

      ข้อดีอย่างหนึ่งของ ChatGPT คือความสามารถในการให้ข้อมูลและคำแนะนำที่เป็นประโยชน์ในหัวข้อต่างๆ รวมถึง Microsoft Excel ด้วย

      เมื่อใช้ ChatGPT เพื่อเรียนรู้ Excel เราสามารถจะได้รับการช่วยเหลือแบบเรียลไทม์ ฝึกฝนกับข้อมูลตัวอย่าง และเรียนรู้ผ่านโครงการและกิจกรรมที่ต้องลงมือปฏิบัติจริงได้ด้วย

      โดยรวมแล้ว ChatGPT เป็นเครื่องมืออเนกประสงค์และมีค่าสำหรับทุกคนที่ต้องการพัฒนาทักษะ Excel และเพิ่มพูนความรู้ด้านซอฟต์แวร์ ไม่ว่าคุณจะเป็นผู้เริ่มต้นหรือผู้ใช้ขั้นสูง ChatGPT สามารถช่วยให้คุณเรียนรู้และเชี่ยวชาญ Excel ได้อย่างสนุกสนานมากขึ้นกว่าเดิม

      วิธีการใช้งาน ChatGPT

      ต่อไปนี้เป็นขั้นตอนในการใช้แพลตฟอร์มบนเว็บ OpenAI เพื่อคุยกับ ChatGPT

      1. ไปที่เว็บไซต์ OpenAI ChatGPT: https://chat.openai.com/
      2. เข้าสู่ระบบ หรือ สมัครสมาชิกบัญชี ซึ่งสามารถใช้ Google ACcount หรือ Microsoft Account ก็ได้
      3. เริ่มใช้ ChatGPT ได้โดยพิมพ์ Chat หรือที่เรียกว่า “พรอมต์” ซึ่งก็คือประโยคหรือคำถามที่คุณส่งไปยัง ChatGPT เพื่อเริ่มการสนทนา
        • ป.ล. แม้จะพิมพ์ไทยได้ แต่แนะนำให้ใช้ภาษาอังกฤษ จะ Work กว่ามาก (ใครไม่ถนัด eng ควรหัดนะ แต่ถ้าไม่ได้จริงๆ ก็ Google Translate ได้ครับ)
      4. อ่านผลการตอบกลับ : ChatGPT จะทำการตอบกลับตามข้อความแบบเดียวกับการคุยกับมนุษย์เลย คุณสามารถอ่านคำตอบและใช้ข้อมูลเพื่อเรียนรู้เพิ่มเติมเกี่ยวกับ Excel หรือรับความช่วยเหลือเกี่ยวกับปัญหาเฉพาะได้
      5. ทำซ้ำตามต้องการ: คุณสามารถพิมพ์พร้อมต์ใน ChatGPT ต่อไปเพื่อรับข้อมูลเพิ่มเติมและคำแนะนำในขณะที่คุณทำงานผ่านเส้นทางการเรียนรู้ของ Excel

      แค่นั้นแหละ! ด้วยขั้นตอนง่ายๆ เหล่านี้ คุณจะสามารถเริ่มใช้แพลตฟอร์มบนเว็บของ OpenAI เพื่อโต้ตอบกับ ChatGPT และรับความช่วยเหลือเกี่ยวกับการศึกษา Excel ของคุณได้แล้ว

      ตัวอย่าง

      คือมันจะเป็น Chat ถามตอบ คิดซะว่าคุยกับเพื่อนชาวต่างประเทศคนนึงที่รอบรู้เกือบทุกเรื่องละกัน (แต่เพื่อนคนนี้อาจตอบผิดบ้างนะ อยา่เชื่อ 100% ต้องทดสอบด้วย)

      10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง 17

      ความเจ๋งคือ เราสามารถคุยโต้ตอบกับมันได้ และมันสามารถจำเรื่องที่คุยไปก่อนหน้าได้ ดังนั้นมันจึง flexible มากๆ เลย

      เอาล่ะ เรามาดูตัวอย่าง การใช้ ChatGPT ในการเรียนรู้ Excelกันดีกว่า ว่ามีอะไรน่าสนใจบ้าง

      Idea การใช้ ChatGPT


      ช่วยแนะนำเกี่ยวกับสูตรและเครื่องมือต่างๆ

      แนวทาง

      เราสามารถถามวิธีทำสิ่งที่ต้องการไปได้เลย โดยที่ไม่จำเป็นต้องรู้ว่าจะใช้ฟังก์ชันอะไรด้วยซ้ำ ที่สำคัญคือ เราต้องลองทำจริงๆ เพราะบางครั้ง ChatGPT ก็มั่ว 555 (โดยเฉพาะพวกคีย์ลัดต่างๆ เนี่ยตัวตอบมั่วเลย)

      10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง 18

      คำถาม

      what formula to get text after space in excel

      คำตอบ

      If you want to extract the text after a space in Excel, you can use the RIGHT or MID functions. Here’s how you can use each function:

      1. RIGHT function: The RIGHT function returns the specified number of characters from the end of a text string. To extract the text after the first space, you can use the following formula:
      =RIGHT(A1,LEN(A1)-FIND(" ",A1))

      Where:

      • A1 is the cell containing the text string.
      • LEN(A1) returns the length of the text string.
      • FIND(” “,A1) returns the position of the first space in the text string.
      1. MID function: The MID function returns a specific number of characters from a text string, starting at a specified position. To extract the text after the first space, you can use the following formula:
      =MID(A1,FIND(" ",A1)+1,LEN(A1))

      Where:

      • A1 is the cell containing the text string.
      • FIND(” “,A1) returns the position of the first space in the text string.
      • LEN(A1) returns the length of the text string.

      These formulas will return the text after the first space in the text string. If you need to extract text after more than one space, you’ll need to nest these functions to perform multiple searches and extractions.

      I hope this helps! Let me know if you have any further questions about extracting text in Excel.

      ให้มันช่วยแก้สูตรที่เขียนผิดให้

      แนวทาง

      บางทีเราเขียนสูตรแล้ว error หรือขี้เกียจเขียนให้ถูก syntax ก็ลองให้มันช่วยแก้ให้ได้เลย เจ๋งดีครับ

      10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง 19

      คำถาม

      can you help me fix formula =INDEX G3:G17 MATCH K3 E3:E17

      คำตอบ

      The formula you provided seems to have some errors. The correct formula should be:

      =INDEX(G3:G17, MATCH(K3, E3:E17, 0))

      The INDEX function retrieves a value in a specified range (G3:G17), based on the row number specified by the MATCH function. The MATCH function returns the relative position of a value (K3) within a specified range (E3:E17). The third argument of the MATCH function, 0, specifies an exact match.

      Make sure to check the range and value references in your formula to ensure they are correct.

      สร้างข้อมูลตัวอย่างใช้ฝึกฝนฝีมือ

      แนวทาง

      เราสามารถบอกให้มันทำข้อมูล Mockup แบบที่เราต้องการได้ เช่น มี heading อะไรบ้าง รายละเอียดเป็นยังไงก็ระบุได้หมด ถ้ายังทำไม่ตรงใจเรา ก็สามารถสั่งให้มันแก้ได้อีกจนกว่าเราจะพอใจ

      คำถาม

      please help create 10 rows mockup data about online shopping transaction as a table format

      คำตอบ

      Here is a mockup data of 10 rows of online shopping transactions in table format:

      DateItemPrice
      1/1/2023Shoes$100
      1/2/2023Shirts$50
      1/3/2023Bags$75
      1/4/2023Sunglasses$25
      1/5/2023Books$20
      1/6/2023Gadgets$150
      1/7/2023Jackets$80
      1/8/2023Headphones$35
      1/9/2023Watches$200
      1/10/2023Backpacks$60

      i want some duplicated date and item. and also need qty column

      Here is a mockup data of 10 rows of online shopping transactions in table format with duplicated dates and items and a quantity column:

      DateItemPriceQty
      1/1/2023Shoes$1002
      1/2/2023Shirts$503
      1/3/2023Bags$751
      1/4/2023Sunglasses$255
      1/4/2023Sunglasses$252
      1/5/2023Books$201
      1/6/2023Gadgets$1502
      1/7/2023Jackets$801
      1/8/2023Headphones$353
      1/9/2023Watches$2001

      ok, please add non dup transaction id

      Sure, here’s the mockup data of 10 rows of online shopping transactions in table format with duplicated dates and items, a quantity column, and a non-duplicated transaction ID:

      Transaction IDDateItemPriceQty
      T00011/1/2023Shoes$1002
      T00021/2/2023Shirts$503
      T00031/3/2023Bags$751
      T00041/4/2023Sunglasses$255
      T00051/4/2023Sunglasses$252
      T00061/5/2023Books$201
      T00071/6/2023Gadgets$1502
      T00081/7/2023Jackets$801
      T00091/8/2023Headphones$353
      T00101/9/2023Watches$2001

      นี่ไง พอใช้ได้ตามที่เราต้องการแล้ว จากนั้นเราจะเอาข้อมูลนี้ไปฝึกอะไรก็ตามใจ

      ทำงานอัตโนมัติด้วยโค้ด VBA

      แนวทาง

      เราสามารถถาม VBA Code จาก ChatGPT ได้เลย แค่บอกว่าต้องการอะไร

      คำถาม

      i want vba code to change tab color for all sheets to be yellow except sheet name “config”

      คำตอบ

      Here’s a VBA code that changes the tab color for all sheets in an Excel workbook to yellow, excluding the sheet named “Config”:

      Sub ChangeTabColor()
          Dim ws As Worksheet
          For Each ws In ThisWorkbook.Sheets
              If ws.Name <> "Config" Then
                  ws.Tab.Color = RGB(255, 255, 0)
              End If
          Next ws
      End Sub
      

      To use this code, follow these steps:

      1. Open the Excel workbook you want to modify.
      2. Press “Alt + F11” to open the VBA editor.
      3. In the editor, select “Insert” from the menu bar and then select “Module”.
      4. Copy and paste the code into the new module.
      5. Save and close the VBA editor.
      6. Back in the Excel workbook, press “Alt + F8” to open the macro dialog box.
      7. Select the “ChangeTabColor” macro and click “Run”.

      This will change the tab color for all sheets in the workbook to yellow, except for the sheet named “Config”.

      จำลองการสัมภาษณ์งาน และข้อสอบต่างๆ

      แนวทาง

      เราสามารถซ้อมตอบคำถาม Excel เวลาจะไปสัมภาษณ์งาน หรือทำข้อสอบเกี่ยวกับ Excel ก็ได้

      คำถาม

      please create Mock up job interview that test my excel knowledge in variety of excel abilities

      คำตอบ

      Sure, here is a list of mock job interview questions that could test a variety of Excel abilities:

      1. Can you explain the difference between absolute and relative cell referencing?
      2. How would you create a chart in Excel to visualize data?
      3. Can you walk me through the steps to use the VLOOKUP function in Excel?
      4. Can you explain how to use conditional formatting in Excel?
      5. How would you set up a budget tracking spreadsheet in Excel?
      6. Can you demonstrate how to use Pivot Tables in Excel?
      7. Can you explain the difference between the IF and IFERROR functions in Excel?
      8. How would you use the INDEX and MATCH functions together to extract data from a table in Excel?
      9. Can you show how to create a drop-down list in Excel?
      10. How would you automate a process in Excel using a macro?
      11. Can you explain how to use the Solver tool in Excel?
      12. Can you walk me through the steps to create a data validation rule in Excel?
      13. How would you set up a loan amortization table in Excel?
      14. Can you explain how to use the SUMIF and SUMIFS functions in Excel?
      15. How would you use the Text to Columns feature in Excel to split text data into separate columns?

      Note: You may tailor these questions to match your Excel knowledge level or the specific requirements of the job you’re interviewing for.

      ฝึกฝน Excel ในรูปแบบเล่นเกมตอบคำถาม

      แนวทาง

      อันนี้คล้ายกับ Job Interview แต่ว่าเราอยากจะตอบเป็น Choice แล้วให้มันบอกว่าเราตอบถูกหรือผิด

      คำถาม

      please ask me choice-based quiz about excel knowledge. let me choose the choice then tell me if my answer is correct or not. one by one question, show my accum score after each question

      คำตอบ

      Sure, here is the first question:

      Question 1: What is the purpose of the SUM function in Excel?

      A) To find the average of a range of cells
      B) To find the total of a range of cells
      C) To find the minimum value in a range of cells
      D) To find the maximum value in a range of cells

      Please enter A, B, C, or D.

      เรา :

      B

      ChatGPT :

      Correct! The SUM function is used to find the total of a range of cells.

      Your current score is 1.

      Here is the next question:

      Question 2: What is the shortcut key to apply the AutoSum formula in Excel?

      A) Alt + =
      B) Ctrl + =
      C) Shift + =
      D) Ctrl + Alt + =

      Please enter A, B, C, or D.

      เรา :

      A

      ChatGPT :

      Correct! The shortcut key to apply the AutoSum formula in Excel is Alt + =.

      Your current score is 2.

      Here is the next question:

      Question 3: How do you create a pivot table in Excel?

      A) Select the data, go to the “Data” tab, click the “Sort & Filter” button, and choose “Sort Ascending”
      B) Select the data, go to the “Data” tab, click the “PivotTable” button, and choose “PivotTable”
      C) Select the data, go to the “Insert” tab, click the “Table” button, and choose “PivotTable”
      D) Select the data, go to the “Home” tab, click the “Sort & Filter” button, and choose “Sort Descending”

      Please enter A, B, C, or D.

      แล้วเราก็เล่นแบบนี้ไปเรื่อยๆ ได้เลยครับ 555

      แนวทางหรือ Best Pratice ในการแก้ปัญหา

      คำถาม

      what is correct way to design database before pivot

      คำตอบ

      Designing a database before creating a pivot table is an important step in ensuring that the pivot table is accurate and effective. The following are best practices for designing a database before using a pivot table:

      1. Organize the data: Make sure that the data is organized in a clear and logical manner, with consistent and meaningful column and row headers.
      2. Remove duplicates: Remove any duplicate records to avoid skewing the results of the pivot table.
      3. Standardize data formats: Ensure that all data is formatted consistently and accurately, such as date and currency formats.
      4. Use proper data types: Assign appropriate data types to each column to ensure that Excel can accurately manipulate the data.
      5. Create meaningful labels: Create meaningful and descriptive labels for each column to help clarify the data.
      6. Normalize the data: Normalize the data by breaking it down into smaller, more manageable tables, and establishing relationships between the tables.
      7. Sort the data: Sort the data in a logical and meaningful manner to help Excel quickly and accurately manipulate the data.
      8. Add calculated columns: Add calculated columns, if needed, to help provide additional insights into the data.

      By following these best practices, you can ensure that your database is well-designed and optimized for use with pivot tables.

      ไอเดียวิเคราะห์ข้อมูลเชิงลึกที่น่าสนใจ

      คำถาม

      what is interesting way to analyze hr employee data to get meaningful insights

      คำตอบ

      To analyze HR employee data and gain meaningful insights, here are some interesting approaches:

      1. Demographic analysis: Analyze the age, gender, education, and other demographic data of your employees to understand the makeup of your workforce.
      2. Turnover analysis: Track and analyze employee turnover rates to identify any trends or patterns and determine if there are any factors contributing to high turnover.
      3. Performance analysis: Use data on employee performance, such as performance ratings, to identify any trends or patterns and determine which employees are outperforming their peers.
      4. Skills analysis: Analyze the skills and experience of your employees to determine which skills are most important for your organization and where there may be skill gaps.
      5. Engagement analysis: Measure and analyze employee engagement to determine the factors that contribute to high engagement levels and identify areas for improvement.
      6. Compensation analysis: Analyze compensation data to determine if there are any disparities in pay based on gender, race, or other factors.

      By using these approaches, you can gain a deeper understanding of your workforce and make data-driven decisions to improve HR processes and employee experiences.

      ช่วย Brainstorm Idea แนะนำ Project ที่น่าทำ

      คำถาม

      i want to create excel project that not too difficult, what should i do, please give me 10 project idea

      คำตอบ

      Sure! Here are 10 simple Excel project ideas:

      1. Personal Budget Tracker: Create a spreadsheet to track your income and expenses.
      2. Meal Planner: Create a spreadsheet to plan and track your weekly meals, including grocery shopping list.
      3. Monthly Bill Tracker: Create a spreadsheet to keep track of all your monthly bills, including due dates and payment status.
      4. Investment Tracker: Create a spreadsheet to track your investment portfolio, including stock prices, returns, and dividends.
      5. Time Tracker: Create a spreadsheet to track how you spend your time, including work, leisure, and sleep.
      6. Exercise Tracker: Create a spreadsheet to track your exercise routine, including type of exercise, duration, and calorie burn.
      7. Home Inventory: Create a spreadsheet to catalog your belongings, including make, model, purchase date, and value.
      8. Weight Tracker: Create a spreadsheet to track your weight loss or gain, including diet, exercise, and other factors.
      9. Book Tracker: Create a spreadsheet to track books you have read, including title, author, genre, and rating.
      10. Project Planner: Create a spreadsheet to plan and track a personal or work project, including tasks, deadlines, and progress.

      แหล่งเรียนรู้ Excel เพิ่มเติมในเรื่องที่สนใจ

      คำถาม

      who is top 5 experts in power query

      คำตอบ

      It’s difficult to determine the exact top 5 experts in Power Query as it can be subjective and based on various factors such as their contribution to the community, expertise, recognition, and online presence. However, some of the well-known names in the Power Query community are:

      1. Ken Puls
      2. Chris Webb
      3. Matt Allington
      4. Miguel Escobar
      5. Avi Singh

      ความเห็นเกี่ยวกับ AI

      และนี่ก็เป็น 10 ไอเดียในการใช้ ChatGPT ช่วยทำให้เราเรียนรู้ Excel ได้ดีขึ้น จะเห็นว่าทักษะสำคัญมากๆ ตอนนี้ก็คือภาษาอังกฤษนะครับ เพราะมันจำเป็นสำหรับการสื่อสารกับ AI เป็นอย่างมาก

      และอย่าลืมว่า เรื่อง AI มันจะมาแน่ๆ ในทุกมิติของการใช้โปรแกรมต่างๆในอนาคต และอีกไม่นาน Excel เองก็จะมี AI ที่เก่งมากๆ มาช่วยเราจัดการข้อมูลแน่นอน

      จริงๆ ปัจจุบัน Excel ก็มี AI อยู่แล้วนะ เช่น Flash Fill, Column From Example หรือแม้แต่ ปุ่ม Analyze Data แต่เราอาจยังไม่ค่อยได้ใช้ เพราะมันยังไม่เก่งมาก แต่มันจะเก่งขึ้นแน่ๆ

      ดังนั้น ในอนาคต นอกจากที่จะต้องวิเคราะห์ข้อมูลเก่งแล้ว เราอาจจะต้องมาฝึกฝนวิธีการสั่งงาน AI ให้ได้ดั่งใจด้วยเช่นกัน หึหึ

      สำหรับประเด็นเรื่องที่ AI เก่งมากจนจะมาแทนที่งานของมนุษย์นั้น ผมเห็นว่าก็มีความเป็นไปได้สูงสำหรับงานที่ค่อนข้าง Routine ไม่ได้ใช้ความสามารถในการวิเคราะห์อะไรที่มันลึกซึ้งมากนัก แต่สำหรับคนที่มีฝีมืออยู่แล้ว การมี AI มาเนี่ยจะช่วยเพิ่มประสิทธิภาพให้คนนั้นได้มหาศาล ดังนั้นในตอนนี้เรายังพอมีเวลาฝึกฝนตัวเองให้มีความสามารถที่เฉียบคมขึ้นได้ จะได้สั่ง AI ได้ดีขึ้น ไม่ใช่ให้มันมาแทนที่เรา

      ป.ล. รูปปกของบทความนี้ ผมก็ใช้ AI ชื่อ MidJourney สร้างขึ้นมาได้แบบสบายๆ ตอนนี้โลกมันไปไกลมาจริงๆ ครับ (ผมเคยเขียนบทความวิธีใช้แบบละเอียดไว้ด้วย แม้ตอนนี้จะมีตัว version ใหม่แล้ว แต่หลักการในบทความยังใช้ได้อยู่)

      10 ไอเดีย เรียนรู้ Excel ผ่าน ChatGPT AI สุดเจ๋ง 20