Spaces:
Build error
Build error
Emiir
commited on
Commit
ยท
fdafbf3
1
Parent(s):
c46880e
Update app.py
Browse files
app.py
CHANGED
@@ -35,31 +35,13 @@ queue = Queue()
|
|
35 |
queue_threshold = 100
|
36 |
|
37 |
|
38 |
-
def add_random_noise(prompt
|
39 |
-
|
40 |
-
|
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(
|
62 |
-
output1 = proc1(
|
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 |
-
|
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
|
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 |
|