import gradio as gr | |
import random # Import random module for generating random seeds | |
# Function to generate a random seed if the given seed is -1 | |
def generate_seed(seed): | |
if seed == -1: | |
return random.randint(0, 999999999) | |
return seed | |
# Define the interface | |
seed_input = gr.components.Number(label="Seed (Set to -1 for random seed)", default=-1, step=1, min=-1) | |
def generate_output(seed): | |
seed = generate_seed(seed) | |
return {"Generated Seed": seed} | |
# Load the model (assuming the model file is present in the specified path) | |
model_interface = gr.load("models/Linaqruf/anything-v3.0") | |
# Combine the interfaces and launch the model interface | |
model_interface.inputs = [seed_input] + model_interface.inputs | |
model_interface.launch(enable_queue=False, share=False) | |