NamanRaii commited on
Commit
00f02cd
·
verified ·
1 Parent(s): 9c0a8ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -1,28 +1,32 @@
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
  print("✅ Glowmation FLUX Engine Ready! (Dev: Naman Rai)")
5
 
6
- # FLUX ki jagah SDXL lagaya jo 100% free API par chalta hai
7
- client = InferenceClient("stabilityai/stable-diffusion-xl-base-1.0")
 
 
 
8
 
9
  def generate_flux_image(prompt):
10
  if not prompt:
11
  return None
12
  try:
13
- # Prompt ko thoda enhance karna for better quality
14
- pro_prompt = prompt + ", masterpiece, high contrast, cinematic lighting, 8k"
15
 
16
- # Free API se image mangwana
17
  image = client.text_to_image(pro_prompt)
18
  return image
19
  except Exception as e:
20
- raise gr.Error(f"⚠️ Kalesh: {str(e)} - Server thoda busy hai, 10 second baad try kar!")
21
 
22
- # ── Dark Mode UI (Tera Favourite) ──
23
  with gr.Blocks(theme=gr.themes.Monochrome()) as iface:
24
- gr.Markdown("# 🔥 Glowmation FLUX Engine")
25
- gr.Markdown("### ⚡ Unlimited Free Text-to-Image API | Dev: Naman Rai")
26
 
27
  with gr.Row():
28
  with gr.Column():
@@ -36,7 +40,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as iface:
36
  with gr.Column():
37
  image_output = gr.Image(label="FLUX Magic Output")
38
 
39
- # API Link ready kar rahe hain frontend ke liye
40
  gen_btn.click(
41
  fn=generate_flux_image,
42
  inputs=prompt_input,
 
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():
 
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,