Bagda commited on
Commit
6356263
·
verified ·
1 Parent(s): 8d02d2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,24 +1,28 @@
 
1
  import torch
2
  from diffusers import StableDiffusionPipeline
3
  import gradio as gr
4
 
5
- # Hugging Face Token (replace with your token)
6
- HF_TOKEN = "hf_your_token_here"
7
 
8
- # Load gated model with auth token
9
  pipe = StableDiffusionPipeline.from_pretrained(
10
  "Linaqruf/anything-v3.0",
11
  use_auth_token=HF_TOKEN,
12
  torch_dtype=torch.float16
13
  ).to("cuda")
14
 
 
15
  def generate_thumbnail(prompt):
16
  image = pipe(prompt).images[0]
17
  return image
18
 
 
19
  gr.Interface(
20
  fn=generate_thumbnail,
21
- inputs=gr.Textbox(label="Prompt"),
22
  outputs=gr.Image(type="pil"),
23
- title="Anime Thumbnail Generator"
 
24
  ).launch()
 
1
+ import os
2
  import torch
3
  from diffusers import StableDiffusionPipeline
4
  import gradio as gr
5
 
6
+ # Hugging Face token from Secrets (for private model access)
7
+ HF_TOKEN = os.getenv("HF_TOKEN")
8
 
9
+ # Load the Anything-V3 model
10
  pipe = StableDiffusionPipeline.from_pretrained(
11
  "Linaqruf/anything-v3.0",
12
  use_auth_token=HF_TOKEN,
13
  torch_dtype=torch.float16
14
  ).to("cuda")
15
 
16
+ # Main generation function
17
  def generate_thumbnail(prompt):
18
  image = pipe(prompt).images[0]
19
  return image
20
 
21
+ # Gradio UI
22
  gr.Interface(
23
  fn=generate_thumbnail,
24
+ inputs=gr.Textbox(label="Enter Thumbnail Prompt"),
25
  outputs=gr.Image(type="pil"),
26
+ title="Anime/Minecraft Style Thumbnail Generator",
27
+ description="Powered by Linaqruf/anything-v3.0 model"
28
  ).launch()