File size: 890 Bytes
05a46d3
0b90440
 
b672c34
0b90440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from huggingface_hub import login
import gradio as gr

# Load Hugging Face API Token from Secrets (Hugging Face Spaces Secrets or Environment Variables)
HF_TOKEN = os.getenv("HF_TOKEN")

# Authenticate with Hugging Face
if HF_TOKEN:
    login(token=HF_TOKEN)
else:
    raise ValueError("❌ Hugging Face Token Not Found. Please set HF_TOKEN in Secrets.")

# Load Stable Diffusion Model from Hugging Face Hub
model = gr.load("models/prithivMLmods/SD3.5-Turbo-Realism-2.0-LoRA")

# Define Gradio Interface
def generate_image(prompt: str):
    return model(prompt)

demo = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Enter a Prompt"),
    outputs="image",
    title="Stable Diffusion Image Generator",
    description="Generate images from text using Stable Diffusion 3.5 Turbo Realism LoRA."
)

# Launch Gradio App
if __name__ == "__main__":
    demo.launch()