Ashrafb commited on
Commit
099f569
1 Parent(s): 9c4c6a7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -14
main.py CHANGED
@@ -91,25 +91,25 @@ def generate_image(inputs, is_negative, steps, cfg_scale, seed):
91
 
92
 
93
 
 
 
94
  def get_prompts(prompt_text):
95
  if not prompt_text:
96
  return "Please enter text before generating prompts.رجاء ادخل النص اولا"
97
  raise gr.Error("Please enter text before generating prompts.رجاء ادخل النص اولا")
98
  else:
99
- global request_counter
100
- request_counter += 1
101
- timestamp = f"{time.time()}_{request_counter}"
102
-
103
- options = [
104
- "photo anime, masterpiece, high quality, absurdres, "
105
- # Add other prompt options here...
106
- ]
107
-
108
- if prompt_text:
109
- chosen_option = random.choice(options)
110
- return text_gen(f"{prompt_text}, {chosen_option}")
111
- else:
112
- return text_gen("", timestamp)
113
 
114
  def initialize_api_connection():
115
  global headers
 
91
 
92
 
93
 
94
+ import time
95
+
96
  def get_prompts(prompt_text):
97
  if not prompt_text:
98
  return "Please enter text before generating prompts.رجاء ادخل النص اولا"
99
  raise gr.Error("Please enter text before generating prompts.رجاء ادخل النص اولا")
100
  else:
101
+ options = [
102
+ "photo anime, masterpiece, high quality, absurdres, "
103
+ # Add other prompt options here...
104
+ ]
105
+
106
+ if prompt_text:
107
+ # Use current time as a seed for random choice
108
+ random.seed(time.time())
109
+ chosen_option = random.choice(options)
110
+ return text_gen(f"{prompt_text}, {chosen_option}")
111
+ else:
112
+ return text_gen("")
 
 
113
 
114
  def initialize_api_connection():
115
  global headers