Emiir commited on
Commit
fdafbf3
ยท
1 Parent(s): c46880e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -27
app.py CHANGED
@@ -35,31 +35,13 @@ queue = Queue()
35
  queue_threshold = 100
36
 
37
 
38
- def add_random_noise(prompt, noise_level=0.00):
39
- if noise_level == 0:
40
- noise_level = 0.00
41
- percentage_noise = noise_level * 5
42
- num_noise_chars = int(len(prompt) * (percentage_noise / 100))
43
- noise_indices = random.sample(range(len(prompt)), num_noise_chars)
44
- prompt_list = list(prompt)
45
- noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
46
- noise_chars.extend(
47
- ['๐Ÿ˜', '๐Ÿ’ฉ', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', '๐Ÿ˜ท', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', '๐Ÿ˜ด', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคช',
48
- '๐Ÿ˜‡', '๐Ÿคข', '๐Ÿ˜ˆ', '๐Ÿ‘น', '๐Ÿ‘ป', '๐Ÿค–', '๐Ÿ‘ฝ', '๐Ÿ’€', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽฎ', 'โค๏ธ',
49
- '๐Ÿ’”', '๐Ÿ’•', '๐Ÿ’–', '๐Ÿ’—', '๐Ÿถ', '๐Ÿฑ', '๐Ÿญ', '๐Ÿน', '๐ŸฆŠ', '๐Ÿป', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿ˜', '๐Ÿ”ฅ', '๐ŸŒง๏ธ', '๐ŸŒž', '๐ŸŒˆ',
50
- '๐Ÿ’ฅ', '๐ŸŒด', '๐ŸŒŠ', '๐ŸŒบ', '๐ŸŒป', '๐ŸŒธ', '๐ŸŽจ', '๐ŸŒ…', '๐ŸŒŒ', 'โ˜๏ธ', 'โ›ˆ๏ธ', 'โ„๏ธ', 'โ˜€๏ธ', '๐ŸŒค๏ธ', 'โ›…๏ธ', '๐ŸŒฅ๏ธ', '๐ŸŒฆ๏ธ', '๐ŸŒง๏ธ',
51
- '๐ŸŒฉ๏ธ', '๐ŸŒจ๏ธ', '๐ŸŒซ๏ธ', 'โ˜”๏ธ', '๐ŸŒฌ๏ธ', '๐Ÿ’จ', '๐ŸŒช๏ธ', '๐ŸŒˆ'])
52
- for index in noise_indices:
53
- prompt_list[index] = random.choice(noise_chars)
54
- return "".join(prompt_list)
55
-
56
-
57
- def send_it1(inputs, noise_level, proc1=proc1):
58
- prompt_with_noise = add_random_noise(inputs, noise_level)
59
  while queue.qsize() >= queue_threshold:
60
  time.sleep(2)
61
- queue.put(prompt_with_noise)
62
- output1 = proc1(prompt_with_noise)
63
  return output1
64
 
65
  with gr.Blocks(css='style.css') as demo:
@@ -103,14 +85,12 @@ with gr.Blocks(css='style.css') as demo:
103
  run = gr.Button("OluลŸtur").style(full_width=False)
104
  prompts = f"Brand: {prompt_marka} / Series: {prompt_seri} / Model: {prompt_model} / Year: {prompt_yil}"
105
 
106
- with gr.Row():
107
- with gr.Row():
108
- noise_level = gr.Slider(minimum=0.0, maximum=3, step=0.1, label="Gรถrรผntรผnรผn Gรผrรผltรผ Katsayฤฑsฤฑ")
109
  with gr.Row():
110
  with gr.Row():
111
  output1 = gr.Image(label="Dreamlike Diffusion 1.0", show_label=False)
112
 
113
- run.click(send_it1, inputs=[prompts, noise_level], outputs=[output1])
114
  with gr.Row():
115
  gr.HTML(
116
 
 
35
  queue_threshold = 100
36
 
37
 
38
+ def add_random_noise(prompt):
39
+
40
+ def send_it1(inputs, proc1=proc1):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  while queue.qsize() >= queue_threshold:
42
  time.sleep(2)
43
+ queue.put(inputs)
44
+ output1 = proc1(inputs)
45
  return output1
46
 
47
  with gr.Blocks(css='style.css') as demo:
 
85
  run = gr.Button("OluลŸtur").style(full_width=False)
86
  prompts = f"Brand: {prompt_marka} / Series: {prompt_seri} / Model: {prompt_model} / Year: {prompt_yil}"
87
 
88
+
 
 
89
  with gr.Row():
90
  with gr.Row():
91
  output1 = gr.Image(label="Dreamlike Diffusion 1.0", show_label=False)
92
 
93
+ run.click(send_it1, inputs=[prompts], outputs=[output1])
94
  with gr.Row():
95
  gr.HTML(
96