【上傳一張照片,定製程式設計師科技感寫真】函式計算一鍵部署 PuLID for FLUX大模型

Serverless社区發表於2024-10-23

在這個屬於程式碼世界的節日裡,我們為你準備了一份特別的禮物,不論你是前端大牛,還是後端高手;無論是資料分析師,還是演算法工程師,只需一張圖片,創下你與程式碼共舞的瞬間,一鍵生成專屬於你的超寫實程式設計師寫真!

10月21日—11月29日,三步輕鬆完成體驗,即可獲得精美電腦包,(活動期間每個工作日限量30個,先到先得)參與活動官網邀請挑戰,更有羅馬仕充電寶、帆布袋等好禮相送。

立即體驗:https://developer.aliyun.com/topic/2024/1024cloudup/fc

掃碼即刻參加活動(建議PC端體驗)

本次實驗在函式計算中內建 PuLID for FLUX,您可以透過函式計算 + Serverless 應用中心一鍵部署 Flux 模型,快速體驗超寫實影像生成的魅力。


測試生成原圖

實驗準備

場景介紹

Flux 模型是由 Black Forest Labs (Stable Diffusion原班人馬創立)推出的一款文字生成影像的AI模型,該模型以其高畫質晰度影像生成和優秀的提示詞遵循能力而受到關注。Flux.1模型在影像質量、提示詞遵循、尺寸和比例的多樣性、排版能力以及輸出的多樣性等方面超越了市場上的主流文生圖模型,在文字生成、非真實場景+文字生成、現實世界真實場景、真實人物、動漫人物以及動物生成上表現都非常出色。

PuLID for Flux 是一個優秀的AI 頭像生成專案,它提供了一種無需訓練 LoRA 就能實現面部遷移資訊保持的方法。這個專案特別適合用於 FLUX.1-dev 模型,能夠生成人臉高度一致性的風格化影像 。PuLID for Flux 的使用場景非常廣泛,包括但不限於藝術創作、虛擬形象定製、影視製作、廣告與營銷以及社交媒體等 。它能夠提供逼真的面部定製,保持原始風格,支援個性化編輯,並且能夠快速生成影像,無需複雜的模型調整或引數最佳化 。


官方示例

領取免費額度

● 開通函式計算 FC

● 開通檔案儲存 NAS

首次開通使用者可領取產品提供的試用額度

  1. 領取函式計算FC免費額度:https://common-buy.aliyun.com/package?planCode=package_fcfreecu_cn

  2. 領取檔案儲存NAS免費額度:https://free.aliyun.com/?spm=5176.59209.J_5834642020.4.dd5f76b97HqUVE&productCode=nas

建立並部署 Flux 模型

1.前往函式計算控制檯。

2.請確認訪問的控制檯是函式計算3.0,否則您需要在右上角單擊體驗函式計算3.0。

3.在左側導航欄,單擊應用。

4.在應用頁面,單擊建立應用。

說明:如果您之前未使用過應用中心,請跳過本步驟,可直接進入下一步。

5.在應用頁面,選擇人工智慧>Flux Pulid 換臉,單擊立即建立。

說明:如果您在應用頁面找不到 Flux Pulid 換臉,您可能登入的是函式計算2.0控制檯。您可在頁面右上角,單擊體驗函式計算3.0

6.在建立應用頁面,角色名稱請確認所需要的許可權均已獲取(若缺失許可權請按照頁面引導進行操作),同時保證檔案儲存NAS已經開通(如果沒有開通,可根據提示進行開通,NAS用來儲存需要的flux模型Lora檔案)。

7.地域選擇距離自己較近的地域,目前支援僅華東1(杭州)、華東2(上海)地域和日本(東京)

由於當前模板涉及Github以及HuggingFace等網站訪問,國內部分地區可能無法直接使用。其他配置保持預設即可,然後單擊建立應用.

8.等待約1分鐘,部署狀態變為部署成功,表示應用部署成功,並生成訪問域名,單擊訪問域名後的連結,開始體驗Flux大模型生圖。

重要:
○ 請注意保護域名的安全,不要洩露給其他人,防止產生額外費用。
○ ***.devsapp.net域名是CNCF SandBox專案Serverless Devs社群所提供,僅供學習和測試使用,不可用於任何生產使用;社群會對該域名進行不定期地撥測,並在域名下發30天后進行回收,強烈建議您繫結自定義域名以獲得更好的使用體驗。

9.首次開啟ComfyUI,遇到無法訪問此網站情況,等待10 秒左右單擊重新載入。

說明:在使用過程中,若長時間不出圖,建議關閉視窗,再次單擊連結訪問。

警告:
由於ComfyUI自身需要長久保持WebSocket連線以同步實時狀態,因此頁面開啟時會持續使用計算資源,即頁面開啟就會有費用產生請您在不使用ComfyUI的時候關閉頁面,如果不進行主動操作,頁面也會在10分鐘後自動關閉,以節省您的費用。

返回如下頁面,表示您已成功訪問ComfyUI。

ComfyUI+Flux+Pulid 實現換臉寫真

1.訪問下方連結,下載預置的JSON檔案到本地機器中,並解壓。

Flux-Pulid程式設計師寫真workflow.json

2.在頁面右下角,單擊Load,將下載並解壓後的json檔案匯入到 ComfyUI 中。

匯入成功後,返回如下頁面。

3.點選“choose file to upload” 上傳本地的人像圖片

說明:您需要先將下方的示例圖片先儲存到本地機器中。

示例圖片:

4.在頁面右下方,直接單擊 Queue Prompt,透過預設的提示詞生成影像

5.因為ComfyUI基於 Serverless 函式計算產品部署,因此生成第一張圖的時候需要冷啟動時間,第一張圖生成需要等待5分鐘左右,後續每張圖生成時間為2-5秒。

6.您可以透過修改“提示詞”生成更多風格

您也可以使用下面示例圖片體驗效果(以下圖片為 AI 生成)

女生可選:

提示詞1:Half-body portrait of a young woman with an expression of awe and fascination, immersed in the intricate web of AI algorithms and data streams, surrounded by sleek laptops and a nest of charging cables. Her blouse bears the words "AI Enthusiast" in an elegant script font, reflecting her passion for artificial intelligence. The background is a soft glow, reminiscent of a well-lit workspace, with a photorealistic touch that adds depth to the scene. Her skin is depicted with natural imperfections, capturing the essence of a candid smartphone snapshot, yet with the detail and texture that suggest the use of a high-quality camera. The image conveys a realistic, non-glamorized portrayal of her features, with an laptop prominently displayed in the corner, indicating her tech-savvy persona.

提示詞2:Half-body portrait of a young girl with an expression of curiosity and excitement, immersed in the digital world of virtual reality, surrounded by high-tech augmented reality glasses and floating holographic screens, her sweatshirt printed with the words "Future Explorer" in a stylish font, the background filled with dynamic data streams and galaxy-like speckles of light, featuring a futuristic style, with photorealistic details and natural skin texture, as if shot with a high-end smartphone, the skin details are authentic and not artificial, with an laptop placed beside her.

男生可選:

提示詞1:Half-body portrait of a young man with a focused and confident smile, surrounded by the glow of encoded matrices and programming languages, with multiple coding monitors and a tangle of data cables around him, his T-shirt printed with "Code Master" in a clean sans-serif font, the background displaying the radiance of digital circuits and optical fibers, featuring a cyberpunk style, with photorealistic visual effects, clear skin texture, as if captured with a professional camera, the skin details are realistic and tactile, with a mechanical keyboard placed beside him.

提示詞2:Half-body portrait of a young man with a gaze that is resolute and brimming with passion, encircled by the halo of innovative technology, surrounded by multiple touch-screen monitors displaying intricate algorithms and system architectures, as well as a maze of data cables and charging wires. He dons a T-shirt imprinted with "Tech Pioneer" in modern, minimalist font, symbolizing his vanguard status in the realm of technology. The background flickers with the indicator lights of smart devices and flowing lines of code, presenting a science fiction style with a tinge of futurism. The image is rendered with photographic realism, skin textures are clearly visible, as if meticulously captured with a professional camera, with details so authentic they eschew any plastic appearance. Beside him lies gaming mouse, hinting at his love and pursuit of high-performance technology.

5.1 您可以透過”通義“或者其他AI大語言模型生成其他提示詞,嘗試其他生圖效果

教程詳情參考活動官網文件:https://developer.aliyun.com/topic/2024/1024cloudup/fc

相關文章