File size: 923 Bytes
5b95000
c982554
5b95000
c982554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import random

# Load the pre-built model interface
model_interface = gr.load("models/ZB-Tech/Text-to-Image")

# Wrapper function to randomize the seed
def generate_with_random_seed(prompt, *args, **kwargs):
    # Generate a random seed (e.g., between 0 and 2^32 - 1)
    random_seed = random.randint(0, 4294967295)
    
    # Call the loaded model interface with the prompt and random seed
    # Assuming the model accepts a 'seed' parameter; adjust if it uses a different name
    return model_interface(prompt, seed=random_seed, *args, **kwargs)

# Create a new Gradio interface with the wrapper
demo = gr.Interface(
    fn=generate_with_random_seed,
    inputs=gr.Textbox(label="Prompt", placeholder="Enter your prompt here"),
    outputs="image",
    title="Text-to-Image with Random Seed",
    description="Generate images with a randomized seed each time."
)

# Launch the interface
demo.launch()