Update index.html
Browse files- index.html +22 -8
index.html
CHANGED
|
@@ -1,24 +1,38 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_client import Client
|
| 3 |
|
|
|
|
| 4 |
client = Client("mrfakename/z-image-turbo")
|
| 5 |
|
| 6 |
def auto_generate(idea):
|
| 7 |
if not idea or not idea.strip():
|
| 8 |
-
return "", None, "❌ Напиши идею"
|
| 9 |
-
|
| 10 |
prompt = f"{idea.strip()}, cinematic composition, highly detailed, photorealistic, realistic lighting, sharp focus, high quality"
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
with gr.Blocks() as app:
|
| 15 |
gr.Markdown("# 🤖 MODARA_AI")
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
auto_btn = gr.Button("⚡ АВТО", variant="primary")
|
| 18 |
status = gr.Textbox(label="📊 Статус", interactive=False)
|
| 19 |
improved = gr.Textbox(label="✨ Улучшенный промпт", interactive=False)
|
| 20 |
result = gr.Image(label="🖼️ Результат")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_client import Client
|
| 3 |
|
| 4 |
+
# Подключение к генератору
|
| 5 |
client = Client("mrfakename/z-image-turbo")
|
| 6 |
|
| 7 |
def auto_generate(idea):
|
| 8 |
if not idea or not idea.strip():
|
| 9 |
+
return "", None, "❌ Напишите идею"
|
| 10 |
+
|
| 11 |
prompt = f"{idea.strip()}, cinematic composition, highly detailed, photorealistic, realistic lighting, sharp focus, high quality"
|
| 12 |
+
|
| 13 |
+
try:
|
| 14 |
+
result = client.predict(prompt=prompt, api_name="/predict")
|
| 15 |
+
return prompt, result, "✅ Изображение готово!"
|
| 16 |
+
except Exception as e:
|
| 17 |
+
return prompt, None, f"❌ Ошибка: {str(e)}"
|
| 18 |
|
| 19 |
with gr.Blocks() as app:
|
| 20 |
gr.Markdown("# 🤖 MODARA_AI")
|
| 21 |
+
|
| 22 |
+
idea = gr.Textbox(
|
| 23 |
+
label="💡 Что создать?",
|
| 24 |
+
placeholder="Например: BMW M5 CS едет ночью по Дубаю"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
auto_btn = gr.Button("⚡ АВТО", variant="primary")
|
| 28 |
status = gr.Textbox(label="📊 Статус", interactive=False)
|
| 29 |
improved = gr.Textbox(label="✨ Улучшенный промпт", interactive=False)
|
| 30 |
result = gr.Image(label="🖼️ Результат")
|
| 31 |
+
|
| 32 |
+
auto_btn.click(
|
| 33 |
+
auto_generate,
|
| 34 |
+
inputs=idea,
|
| 35 |
+
outputs=[improved, result, status]
|
| 36 |
+
)
|
| 37 |
|
| 38 |
+
app.launch()
|
|
|
|
|
|