Spaces:
Running
Running
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from huggingface_hub import InferenceClient
|
| 4 |
-
|
| 5 |
-
print("✅ Glowmation FLUX Engine Ready! (Dev: Naman Rai)")
|
| 6 |
-
|
| 7 |
-
# 🗝️ Settings (Secrets) se tera VIP Pass utha rahe hain
|
| 8 |
-
hf_token = os.environ.get("HF_TOKEN")
|
| 9 |
-
|
| 10 |
-
# 🚀 FLUX.1 API ko Token ke sath start kar rahe hain
|
| 11 |
-
client = InferenceClient("black-forest-labs/FLUX.1-schnell", token=hf_token)
|
| 12 |
-
|
| 13 |
-
def generate_flux_image(prompt):
|
| 14 |
-
if not prompt:
|
| 15 |
-
return None
|
| 16 |
-
try:
|
| 17 |
-
# Prompt ko aur khatarnak banane ke liye keywords add kiye hain
|
| 18 |
-
pro_prompt = prompt + ", masterpiece, high contrast, cinematic lighting, 8k resolution, ultra-detailed"
|
| 19 |
-
|
| 20 |
-
# API se image mangwana
|
| 21 |
-
image = client.text_to_image(pro_prompt)
|
| 22 |
-
return image
|
| 23 |
-
except Exception as e:
|
| 24 |
-
raise gr.Error(f"⚠️ Kalesh: {str(e)} - 10 second baad try kar!")
|
| 25 |
-
|
| 26 |
-
# ── Dark Mode UI ──
|
| 27 |
-
with gr.Blocks(theme=gr.themes.Monochrome()) as iface:
|
| 28 |
-
gr.Markdown("# 🔥 Glowmation FLUX Engine (VIP Mode)")
|
| 29 |
-
gr.Markdown("### ⚡ Free & Fast Text-to-Image API | Dev: Naman Rai")
|
| 30 |
-
|
| 31 |
-
with gr.Row():
|
| 32 |
-
with gr.Column():
|
| 33 |
-
prompt_input = gr.Textbox(
|
| 34 |
-
label="Kya banwana hai?",
|
| 35 |
-
placeholder="e.g., A 3D character dropping from a plane like BGMI, intense action, dark theme",
|
| 36 |
-
lines=3
|
| 37 |
-
)
|
| 38 |
-
gen_btn = gr.Button("✨ Generate Image", variant="primary")
|
| 39 |
-
|
| 40 |
-
with gr.Column():
|
| 41 |
-
image_output = gr.Image(label="FLUX Magic Output")
|
| 42 |
-
|
| 43 |
-
# API Link
|
| 44 |
-
gen_btn.click(
|
| 45 |
-
fn=generate_flux_image,
|
| 46 |
-
inputs=prompt_input,
|
| 47 |
-
outputs=image_output,
|
| 48 |
-
api_name="generate"
|
| 49 |
-
)
|
| 50 |
-
|
| 51 |
-
iface.queue(default_concurrency_limit=1, max_size=20).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|