app.py
Browse files
App.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def build_prompt(image, caption, scene, target):
|
| 4 |
+
# Fotoğraf açıklaması detaylandırma (Joy-Caption tarzı basit bir taklit)
|
| 5 |
+
img_desc = f"Fotoğraf: {caption.strip()}" if caption else "Fotoğraf: [Açıklama yok]"
|
| 6 |
+
scene_desc = f"Sahne: {scene.strip()}" if scene else "Sahne: [Belirtilmemiş]"
|
| 7 |
+
|
| 8 |
+
# Pozitif ve negatif promptlar
|
| 9 |
+
positive = f"{img_desc}, {scene_desc}, yüksek çözünürlük, gerçekçi detay, doğal ışık"
|
| 10 |
+
negative = "blur, low quality, glitch, bad anatomy, extra limbs, distortions"
|
| 11 |
+
|
| 12 |
+
# Platforma göre çıktıyı özelleştir
|
| 13 |
+
if target == "deepmode":
|
| 14 |
+
positive += " [DeepMode style]"
|
| 15 |
+
elif target == "freegf":
|
| 16 |
+
positive += " [FreeGF format]"
|
| 17 |
+
elif target == "soulgen":
|
| 18 |
+
positive += " [Soulgen format]"
|
| 19 |
+
|
| 20 |
+
return positive, negative
|
| 21 |
+
|
| 22 |
+
with gr.Blocks() as demo:
|
| 23 |
+
gr.Markdown("## 🚀 Universal AI Prompt Builder")
|
| 24 |
+
|
| 25 |
+
with gr.Row():
|
| 26 |
+
target = gr.Dropdown(choices=["deepmode", "freegf", "soulgen"], label="🎯 Hedef Platform")
|
| 27 |
+
|
| 28 |
+
with gr.Row():
|
| 29 |
+
image = gr.Image(type="filepath", label="📷 Fotoğraf Yükle")
|
| 30 |
+
|
| 31 |
+
caption = gr.Textbox(label="📝 Fotoğraf Açıklaması (detaylı yaz)")
|
| 32 |
+
scene = gr.Textbox(label="🎬 Sahne")
|
| 33 |
+
|
| 34 |
+
btn = gr.Button("🚀 PROMPT OLUŞTUR")
|
| 35 |
+
|
| 36 |
+
pos = gr.Textbox(label="✅ Positive Prompt")
|
| 37 |
+
neg = gr.Textbox(label="❌ Negative Prompt")
|
| 38 |
+
|
| 39 |
+
btn.click(build_prompt, inputs=[image, caption, scene, target], outputs=[pos, neg])
|
| 40 |
+
|
| 41 |
+
demo.launch()
|