rubend18 commited on
Commit
81cc901
·
1 Parent(s): 509da71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -2,9 +2,14 @@ import gradio as gr
2
  import random
3
  import re
4
 
5
- def generate_sentence():
6
- template = "#content#, #img-type#, #img-mod#."
7
- return resolve(template).capitalize()
 
 
 
 
 
8
 
9
  def resolve(template):
10
  result = template
@@ -20,7 +25,6 @@ def get_random_from_array(array):
20
 
21
  def get_options_by_placeholder(param):
22
  switcher = {
23
- "#content#": ["#humanoid# #human-mod# in #setting#", "#holdable# #obj-mod# in #setting#"],
24
  "#img-type#": ["On the television show #show#", "In the movie #movie#", "Painting by #painter#", "Cover of #magazine# magazine", "Realistic photograph", "Realistic painting", "Selfie", "Pixel Art", "Portrait", "Detailed scientific diagram", "Movie Poster", "Victorian Newspaper article", "Cinematic shot", "Digital art", "35mm photograph", "Baroque painting", "Advertisement", "Comic-style art", "Book cover", "Early 1900s newspaper", "Renaissance painting", "Sculpture", "Grafitti art", "Crayon art by 5 year old", "watercolors by 5 year old", "1960s Cartoon", "Cyberpunk digital art", "Go pro footage", "Oil painting", "Sketch", "Neoclassical painting"],
25
  "#img-mod#": ["Hyperrealistic", "Closeup", "Award winning", "Vintage", "4K HD", "Highly Detailed"],
26
  "#food#": ["a bowl of cereal", "hot wings", "cake", "pizza", "a hamburger", "french fries", "a plate of nachos", "onion rings", "pudding", "#veggie#", "#fruit#"],
@@ -56,7 +60,7 @@ def generate_prompt():
56
  prompt = generate_sentence()
57
  return prompt
58
 
59
- value1 = gr.inputs.Textbox(label="Character", placeholder="Enter the character...")
60
  value2 = gr.outputs.Textbox(label="Prompt")
61
 
62
  # examples = [
 
2
  import random
3
  import re
4
 
5
+ def generate_sentence(type):
6
+ if language == "Humanoid":
7
+ template = "#humanoid# #human-mod# in #setting#, #img-type#, #img-mod#."
8
+ return resolve(template).capitalize()
9
+
10
+ if language == "Holdable":
11
+ template = "#holdable# #obj-mod# in #setting#, #img-type#, #img-mod#."
12
+ return resolve(template).capitalize()
13
 
14
  def resolve(template):
15
  result = template
 
25
 
26
  def get_options_by_placeholder(param):
27
  switcher = {
 
28
  "#img-type#": ["On the television show #show#", "In the movie #movie#", "Painting by #painter#", "Cover of #magazine# magazine", "Realistic photograph", "Realistic painting", "Selfie", "Pixel Art", "Portrait", "Detailed scientific diagram", "Movie Poster", "Victorian Newspaper article", "Cinematic shot", "Digital art", "35mm photograph", "Baroque painting", "Advertisement", "Comic-style art", "Book cover", "Early 1900s newspaper", "Renaissance painting", "Sculpture", "Grafitti art", "Crayon art by 5 year old", "watercolors by 5 year old", "1960s Cartoon", "Cyberpunk digital art", "Go pro footage", "Oil painting", "Sketch", "Neoclassical painting"],
29
  "#img-mod#": ["Hyperrealistic", "Closeup", "Award winning", "Vintage", "4K HD", "Highly Detailed"],
30
  "#food#": ["a bowl of cereal", "hot wings", "cake", "pizza", "a hamburger", "french fries", "a plate of nachos", "onion rings", "pudding", "#veggie#", "#fruit#"],
 
60
  prompt = generate_sentence()
61
  return prompt
62
 
63
+ value1 = gr.inputs.Radio(choices=["Humanoid", "Holdable"], label="Select the type")
64
  value2 = gr.outputs.Textbox(label="Prompt")
65
 
66
  # examples = [