|
import gradio as gr |
|
import random |
|
|
|
|
|
def generate_seed(seed): |
|
if seed == -1: |
|
return random.randint(0, 999999999) |
|
return seed |
|
|
|
|
|
text_input = gr.inputs.Textbox(label="Input Text") |
|
|
|
|
|
seed_input = gr.inputs.Number(label="Seed (Set to -1 for random seed)", default=-1, min=-1) |
|
|
|
|
|
button = gr.inputs.Button(label="Process") |
|
|
|
def generate_output(text, seed): |
|
seed = generate_seed(seed) |
|
return {"Input Text": text, "Generated Seed": seed} |
|
|
|
|
|
interface = gr.Interface(fn=generate_output, inputs=[text_input, seed_input, button], outputs="text") |
|
|
|
|
|
interface.launch(enable_queue=False, share=False) |
|
|