File size: 1,005 Bytes
ef600c2 2b4285e ef600c2 071d0df ef600c2 a542bfa ef600c2 c7a4c8e ef600c2 24e7bc4 |
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 33 34 35 36 |
import random
import yaml
import gradio as gr
def generate_text():
input_data = get_options('female.yaml')
command = input_data['command']
for key in input_data.keys():
if key != 'command':
command = command.replace(f'[{key}]', input_data[key][random.randint(0, len(input_data[key]) - 1)])
return command
def get_options(file_path):
with open(file_path, 'r') as file:
options = yaml.load(file, Loader=yaml.FullLoader)
return options
iface = gr.Interface(
fn=generate_text,
inputs=None,
outputs=gr.outputs.Textbox(label="Generated Text"),
title="Beautiful Female AI Generator Prompts",
description="Generates a random text prompt for a female by AI ",
allow_flagging=False,
theme="compact",
examples=[
["Generate"],
["Generate"],
["Generate"]
],
# Add image to the interface
image="https://iraqprogrammer.files.wordpress.com/2023/03/00045-3227812873.png?w=1400&h="
)
iface.launch()
|