Spaces:
Sleeping
Sleeping
Commit
ยท
be8e666
1
Parent(s):
8f05a89
Update app.py (#3)
Browse files- Update app.py (4a20c1e7899a968541a758b27e30d2550e005bef)
Co-authored-by: cs <[email protected]>
app.py
CHANGED
@@ -1,23 +1,33 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def calculator(num1, operation, num2):
|
4 |
-
if operation == "add":
|
5 |
-
return num1 + num2
|
6 |
-
elif operation == "subtract":
|
7 |
-
return num1 - num2
|
8 |
-
elif operation == "multiply":
|
9 |
-
return num1 * num2
|
10 |
-
elif operation == "divide":
|
11 |
-
return num1 / num2
|
12 |
|
13 |
demo = gr.Interface(
|
14 |
-
|
15 |
-
[
|
16 |
-
"
|
17 |
-
gr.
|
18 |
-
"
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
)
|
23 |
-
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
sex_value = ""
|
5 |
+
age_value = 0
|
6 |
+
|
7 |
+
def prompt(user_upload, name, sex_value, age_value):
|
8 |
+
|
9 |
+
if sex_value == "male":
|
10 |
+
sex = "man"
|
11 |
+
elif sex_value == "female":
|
12 |
+
sex = "women"
|
13 |
+
else:
|
14 |
+
sex = "nutral person"
|
15 |
+
|
16 |
+
return "RAW photo, VAR TRIGGERWORD, photo a " + sex + ",wearing a suit, " + str(age_value) + " years old,standing on a huge stage, energetic pose, wide shot, huge american flag in background, stage lighting --n (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, mutated hands and fingers:1.4), (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, amputation", name
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
demo = gr.Interface(
|
20 |
+
fn=prompt,
|
21 |
+
inputs=[
|
22 |
+
gr.Files(label="upload 10 pics", file_count="multiple", file_types=["image", ".jpg"]),
|
23 |
+
gr.Textbox(label="name"),
|
24 |
+
gr.Radio(["male", "female", "none binary"], label="sex"),
|
25 |
+
gr.Slider(18, 99, step=1, label="age")
|
26 |
+
],
|
27 |
+
outputs=[
|
28 |
+
gr.Textbox(label="prompt"),
|
29 |
+
gr.Textbox(label="name"),
|
30 |
+
]
|
31 |
)
|
32 |
+
|
33 |
+
demo.launch()
|