Skip to content

Commit 4e205b1

Browse files
committed
add /ai/foundations/image-generation
1 parent a97313a commit 4e205b1

4 files changed

Lines changed: 303 additions & 4 deletions

File tree

src/components/Sidebar/data.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import {
7979
GoKebabHorizontal,
8080
GoMortarBoard,
8181
GoSearch,
82+
GoImage,
8283
GoIterations,
8384
GoSignOut,
8485
GoReply,
@@ -342,6 +343,11 @@ export default {
342343
icon: <GoSearch />,
343344
link: "/ai/foundations/websearch"
344345
},
346+
{
347+
title: "تولید تصویر",
348+
icon: <GoImage />,
349+
link: "/ai/foundations/image-generation"
350+
},
345351
{
346352
hr: true
347353
},

src/data/liara-ai-models.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"google/gemini-2.5-flash",
1212
"google/gemma-3-27b-it",
1313
"google/gemini-2.5-pro",
14-
"google/gemini-3-pro-preview"
14+
"google/gemini-3-pro-preview",
15+
"google/gemini-embedding-001",
16+
"google/gemini-3-flash-preview"
1517
],
1618
"meta-llama": [
1719
"meta-llama/llama-3.3-70b-instruct"
@@ -23,7 +25,8 @@
2325
"anthropic/claude-opus-4",
2426
"anthropic/claude-sonnet-4",
2527
"anthropic/claude-sonnet-4.5",
26-
"anthropic/claude-haiku-4.5"
28+
"anthropic/claude-haiku-4.5",
29+
"anthropic/claude-opus-4.5"
2730
],
2831
"openai": [
2932
"openai/gpt-4.1-mini",
@@ -43,8 +46,13 @@
4346
"openai/gpt-5-codex",
4447
"openai/gpt-5.1-codex",
4548
"openai/gpt-5.1",
49+
"openai/gpt-5.1-chat",
4650
"openai/gpt-5.1-codex-mini",
47-
"openai/gpt-5.1-chat"
51+
"openai/gpt-image-1.5",
52+
"openai/gpt-image-1",
53+
"openai/gpt-image-1-mini",
54+
"openai/gpt-5.2",
55+
"openai/gpt-5.2-chat"
4856
],
4957
"x-ai": [
5058
"x-ai/grok-3-mini-beta",
@@ -66,8 +74,8 @@
6674
"qwen/qwen3-235b-a22b-thinking-2507",
6775
"qwen/qwen3-32b",
6876
"qwen/qwen-turbo",
69-
"qwen/qwen-2.5-72b-instruct",
7077
"qwen/qwen-plus",
78+
"qwen/qwen-2.5-72b-instruct",
7179
"qwen/qwen-max"
7280
],
7381
"moonshotai": [

src/pages/ai/about.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
GoDatabase,
2121
GoRocket,
2222
GoServer,
23+
GoImage,
2324
GoMail,
2425
GoGlobe,
2526
GoArrowLeft,
@@ -168,6 +169,11 @@ import Head from "next/head";
168169
icon: <GoSearch />,
169170
link: "/ai/foundations/websearch"
170171
},
172+
{
173+
title: "تولید تصویر",
174+
icon: <GoImage />,
175+
link: "/ai/foundations/image-generation"
176+
},
171177
].map(item =>
172178
<Link href={item.link}>
173179
<Card className="flex cursor-pointer w-full items-center justify-between">
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
import Layout from "@/components/Layout";
2+
import Button from "@/components/Common/button";
3+
import Section from "@/components/Common/section";
4+
import Alert from "@/components/Common/alert";
5+
import ThemePlatformIcon from "@/components/Common/themeIcons"
6+
import Tabs from "@/components/Common/tab";
7+
import Step from "@/components/Common/step";
8+
import Card from "@/components/Common/card";
9+
import Important from "@/components/Common/important";
10+
import Highlight from "@/components/Common/highlight";
11+
import Link from "next/link";
12+
import PlatformIcon from "@/components/Common/icons";
13+
import HighlightTabs from "@/components/Common/HighlightTabs";
14+
import IconContainer from "@/components/Common/IconContainer";
15+
import {
16+
GoContainer,
17+
GoDatabase,
18+
GoRocket,
19+
GoServer,
20+
GoMail,
21+
GoGlobe,
22+
GoArrowLeft,
23+
GoTelescope,
24+
} from "react-icons/go";
25+
26+
import Head from "next/head";
27+
28+
<Layout>
29+
<Head>
30+
<title>مستندات تولید تصویر با مدل های هوش مصنوعی - لیارا</title>
31+
<meta property="og:title" content="مستندات خدمات رایانش ابری لیارا" />
32+
<meta property="og:description" content="مستندات مربوط به نحوه تولید تصویر یا همان image generation با استفاده از مدل‌های تولید عکس هوش مصنوعی لیارا" />
33+
</Head>
34+
35+
36+
# نحوه تولید تصویر با هوش مصنوعی
37+
<hr className="mb-2" />
38+
39+
طبق <a href="https://www.cloudflare.com/learning/ai/ai-image-generation/" className="text-[#2196f3]">مستندات موجود در Cloudflare</a
40+
هوش مصنوعی تولید تصویر یا AI image generation نوعی از <a href="/ai/foundations/overview/#generative-artificial-intelligence" className="text-[#2196f3]">هوش مصنوعی مولد</a> است که برای خلق محتوای دیداری به کار می‌رود.
41+
<div className="h-2" />
42+
43+
این فناوری با استفاده از تحلیل‌های ریاضی، الگوهای موجود در تصاویر و نگاره‌ها را شناسایی و تکرار می‌کند. به بیان ساده‌تر، هوش مصنوعی تولید تصویر، تصاویر را بر اساس مجموعه‌ای از نمونه‌ها ایجاد می‌کند.
44+
<hr className="mb-2" />
45+
46+
<Section id='what-is-ai-image-generation' title='هوش مصنوعی تولید تصویر چیست؟' />
47+
48+
خلق تصاویر کاملاً جدید با استفاده از مدل‌های هوش مصنوعی بر اساس توصیفات متنی یا پارامترهای از پیش تعیین‌شده.
49+
50+
<Section id='what-is-ai-image-editing' title='هوش مصنوعی ویرایش تصویر چیست؟' />
51+
52+
تغییر یا بهبود تصاویر موجود با کمک الگوریتم‌های هوش مصنوعی، مانند اصلاح رنگ، حذف عناصر ناخواسته یا بهبود جزئیات.
53+
54+
<Section id='what-is-difference-between-image-generation-and-image-editing' title='تفاوت هوش مصنوعی تولید تصویر با ویرایش تصویر چیست؟' />
55+
56+
تولید تصویر خلق چیزی کاملاً جدید است، در حالی که ویرایش تصویر اصلاح و تغییر تصویر موجود است.
57+
58+
<hr className="mb-2" />
59+
<Section id='langs-and-frameworks' title='تولید تصویر در زبان‌ها و فریم‌ورک‌های مختلف' />
60+
61+
<Tabs
62+
tabs={[
63+
{
64+
label: "JavaScript",
65+
icon: <PlatformIcon platform="nodejs" style={{ width: 32, height: 32 }} />,
66+
},
67+
{
68+
label: "Python",
69+
icon: <PlatformIcon platform="python" style={{ width: 32, height: 32 }} />,
70+
},
71+
{
72+
label: "cURL",
73+
},
74+
]}
75+
content={[
76+
77+
<>
78+
<div className="h-2" />
79+
<div dir='ltr'>
80+
<Highlight className="js">
81+
{`import OpenAI from "openai";
82+
import fs from "fs";
83+
84+
const openai = new OpenAI({
85+
baseURL: "<LIARA_BASE_URL>",
86+
apiKey: "<LIARA_API_KEY>"
87+
});
88+
89+
const prompt = \`Tom Cat hugging Spike Bulldog\`;
90+
91+
const result = await openai.images.generate({
92+
model: "openai/gpt-image-1", // choose your model here
93+
prompt,
94+
});
95+
96+
const image_base64 = result.data[0].b64_json;
97+
const image_bytes = Buffer.from(image_base64, "base64");
98+
fs.writeFileSync("output.png", image_bytes);
99+
`}
100+
</Highlight>
101+
</div>
102+
</>,
103+
<>
104+
<div className="h-2" />
105+
<div dir='ltr'>
106+
<Highlight className="py">
107+
{`from openai import OpenAI
108+
import base64
109+
110+
client = OpenAI(
111+
base_url="<LIARA_BASE_URL>",
112+
api_key="<LIARA_API_KEY>"
113+
)
114+
115+
prompt = "Tom Cat hugging Spike Bulldog"
116+
117+
result = client.images.generate(
118+
model="openai/gpt-image-1",
119+
prompt=prompt
120+
)
121+
122+
image_base64 = result.data[0].b64_json
123+
image_bytes = base64.b64decode(image_base64)
124+
125+
with open("output.png", "wb") as f:
126+
f.write(image_bytes)`}
127+
</Highlight>
128+
</div>
129+
</>,
130+
131+
<>
132+
<div className="h-2" />
133+
<div dir='ltr'>
134+
<Highlight className="bash">
135+
{`curl <LIARA_BASE_URL>/images/generations \\
136+
-H "Content-Type: application/json" \\
137+
-H "Authorization: Bearer <LIARA_API_KEY>" \\
138+
-d '{
139+
"model": "openai/gpt-image-1-mini",
140+
"prompt": "A cute baby sea otter",
141+
"n": 1,
142+
"size": "1024x1024",
143+
"quality": "high"
144+
}'`}
145+
</Highlight>
146+
</div>
147+
</>,
148+
]}
149+
150+
/>
151+
152+
153+
{/*
154+
<Section id='edit-on-langs-and-frameworks' title='ویرایش تصویر در زبان‌ها و فریم‌ورک‌های مختلف' />
155+
156+
<Tabs
157+
tabs={[
158+
{
159+
label: "JavaScript",
160+
icon: <PlatformIcon platform="nodejs" style={{ width: 32, height: 32 }} />,
161+
},
162+
{
163+
label: "PHP",
164+
icon: <PlatformIcon platform="php" style={{ width: 32, height: 32 }} />,
165+
},
166+
{
167+
label: "Python",
168+
icon: <PlatformIcon platform="python" style={{ width: 32, height: 32 }} />,
169+
},
170+
{
171+
label: "NET.",
172+
icon: <PlatformIcon platform="dotnet" style={{ width: 32, height: 32 }} />,
173+
},
174+
{
175+
label: "Go",
176+
icon: <PlatformIcon platform="go" style={{ width: 32, height: 32 }} />,
177+
},
178+
{
179+
label: "cURL",
180+
},
181+
]}
182+
content={[
183+
184+
<>
185+
<div className="h-2" />
186+
<div dir='ltr'>
187+
<Highlight className="js">
188+
{`import OpenAI from "openai";
189+
import fs from "fs";
190+
191+
const openai = new OpenAI({
192+
baseURL: "<LIARA_BASE_URL>",
193+
apiKey: "<LIARA_API_KEY>"
194+
});
195+
196+
const prompt = \`Tom Cat hugging Spike Bulldog\`;
197+
198+
const result = await openai.images.generate({
199+
model: "openai/gpt-image-1", // choose your model here
200+
prompt,
201+
});
202+
203+
const image_base64 = result.data[0].b64_json;
204+
const image_bytes = Buffer.from(image_base64, "base64");
205+
fs.writeFileSync("output.png", image_bytes);
206+
`}
207+
</Highlight>
208+
</div>
209+
</>,
210+
<>
211+
<div className="h-2" />
212+
<div dir='ltr'>
213+
<Highlight className="js">
214+
{``}
215+
</Highlight>
216+
</div>
217+
</>,
218+
<>
219+
<div className="h-2" />
220+
<div dir='ltr'>
221+
<Highlight className="js">
222+
{``}
223+
</Highlight>
224+
</div>
225+
</>,
226+
<>
227+
<div className="h-2" />
228+
<div dir='ltr'>
229+
<Highlight className="js">
230+
{``}
231+
</Highlight>
232+
</div>
233+
</>,
234+
<>
235+
<div className="h-2" />
236+
<div dir='ltr'>
237+
<Highlight className="js">
238+
{``}
239+
</Highlight>
240+
</div>
241+
</>,
242+
<>
243+
<div className="h-2" />
244+
<div dir='ltr'>
245+
<Highlight className="js">
246+
{``}
247+
</Highlight>
248+
</div>
249+
</>,
250+
]}
251+
252+
/>
253+
*/}
254+
255+
{/*
256+
<Section id='' title='' />
257+
<Important>
258+
</Important>
259+
<hr className="mb-2" />
260+
<div dir='ltr'>
261+
<Highlight className="js">
262+
{``}
263+
</Highlight>
264+
</div>
265+
<div className="h-2" />
266+
267+
<div className="h-2" />
268+
<img src="https://media.liara.ir/" alt=""/>
269+
<div className="h-2" />
270+
271+
272+
<video
273+
src="https://media.liara.ir/"
274+
controls="controls"
275+
className="block w-full"
276+
width="100%"
277+
/> */}
278+
279+
</Layout>

0 commit comments

Comments
 (0)