Spaces:
Paused
Paused
Kunpeng Song
commited on
Commit
•
735db2e
1
Parent(s):
89092e7
strength
Browse files- app.py +9 -7
- checkpoints/attn_adapters_projectors.th +1 -0
- dataset_lib/__pycache__/dataset_eval_MoMA.cpython-310.pyc +0 -0
- example_images/newImages/1.jpeg +0 -0
- flagged/log.csv +2 -0
- model_lib/__pycache__/__init__.cpython-310.pyc +0 -0
- model_lib/__pycache__/__init__.cpython-39.pyc +0 -0
- model_lib/__pycache__/attention_processor.cpython-310.pyc +0 -0
- model_lib/__pycache__/moMA_generator.cpython-310.pyc +0 -0
- model_lib/__pycache__/moMA_generator.cpython-39.pyc +0 -0
- model_lib/__pycache__/modules.cpython-310.pyc +0 -0
- model_lib/__pycache__/modules.cpython-39.pyc +0 -0
- model_lib/__pycache__/utils.cpython-310.pyc +0 -0
app.py
CHANGED
@@ -12,17 +12,18 @@ import os
|
|
12 |
os.environ["CUDA_VISIBLE_DEVICES"]="0"
|
13 |
|
14 |
title = "MoMA"
|
15 |
-
description = "This model has to run on GPU"
|
|
|
16 |
article = "<p style='text-align: center'><a href='https://news.machinelearning.sg/posts/beautiful_profile_pics_remove_background_image_with_deeplabv3/'>Blog</a> | <a href='https://github.com/eugenesiow/practical-ml'>Github Repo</a></p>"
|
17 |
|
18 |
-
def MoMA_demo(rgb, subject, prompt):
|
19 |
# move the input and model to GPU for speed if available
|
20 |
with torch.no_grad():
|
21 |
-
generated_image = model.generate_images(rgb, subject, prompt, strength=
|
22 |
return generated_image
|
23 |
|
24 |
-
def inference(rgb, subject, prompt):
|
25 |
-
result = MoMA_demo(rgb, subject, prompt)
|
26 |
return result
|
27 |
|
28 |
seed_everything(0)
|
@@ -41,11 +42,12 @@ gr.Interface(
|
|
41 |
inference,
|
42 |
[gr.Image(type="pil", label="Input RGB"),
|
43 |
gr.Textbox(lines=1, label="subject"),
|
44 |
-
gr.Textbox(lines=
|
|
|
45 |
gr.Image(type="pil", label="Output"),
|
46 |
title=title,
|
47 |
description=description,
|
48 |
article=article,
|
49 |
-
examples=[["example_images/newImages/3.jpg",'car','A car in autumn with falling leaves.']],
|
50 |
# enable_queue=True
|
51 |
).launch(debug=False)
|
|
|
12 |
os.environ["CUDA_VISIBLE_DEVICES"]="0"
|
13 |
|
14 |
title = "MoMA"
|
15 |
+
description = "This model has to run on GPU. By default, we load the model with 4-bit quantization to make it fit in smaller hardwares."
|
16 |
+
|
17 |
article = "<p style='text-align: center'><a href='https://news.machinelearning.sg/posts/beautiful_profile_pics_remove_background_image_with_deeplabv3/'>Blog</a> | <a href='https://github.com/eugenesiow/practical-ml'>Github Repo</a></p>"
|
18 |
|
19 |
+
def MoMA_demo(rgb, subject, prompt, strength):
|
20 |
# move the input and model to GPU for speed if available
|
21 |
with torch.no_grad():
|
22 |
+
generated_image = model.generate_images(rgb, subject, prompt, strength=strength, seed=np.random.randint(0,1000))
|
23 |
return generated_image
|
24 |
|
25 |
+
def inference(rgb, subject, prompt, strength):
|
26 |
+
result = MoMA_demo(rgb, subject, prompt, strength)
|
27 |
return result
|
28 |
|
29 |
seed_everything(0)
|
|
|
42 |
inference,
|
43 |
[gr.Image(type="pil", label="Input RGB"),
|
44 |
gr.Textbox(lines=1, label="subject"),
|
45 |
+
gr.Textbox(lines=1, label="Prompt"),
|
46 |
+
gr.Slider(minimum=0.2, maximum=1.2, step=0.1,label="Strength",default=1.0)],
|
47 |
gr.Image(type="pil", label="Output"),
|
48 |
title=title,
|
49 |
description=description,
|
50 |
article=article,
|
51 |
+
examples=[["example_images/newImages/3.jpg",'car','A car in autumn with falling leaves.',1.0],["example_images/newImages/1.jpeg",'bird','A bird in spring with flowers.',1.0]],
|
52 |
# enable_queue=True
|
53 |
).launch(debug=False)
|
checkpoints/attn_adapters_projectors.th
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../../../../../../../home/ks1418/.cache/huggingface/hub/models--KunpengSong--MoMA_llava_7b/blobs/0b432a39e46f01cd9cdb4794b8ef13b9bb0aff2ad6da6800d67fd2ca4af21fa6
|
dataset_lib/__pycache__/dataset_eval_MoMA.cpython-310.pyc
CHANGED
Binary files a/dataset_lib/__pycache__/dataset_eval_MoMA.cpython-310.pyc and b/dataset_lib/__pycache__/dataset_eval_MoMA.cpython-310.pyc differ
|
|
example_images/newImages/1.jpeg
ADDED
![]() |
flagged/log.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Input RGB,subject,Prompt,Strength,Output,flag,username,timestamp
|
2 |
+
,,,0.2,,,,2024-05-21 18:52:10.695138
|
model_lib/__pycache__/__init__.cpython-310.pyc
CHANGED
Binary files a/model_lib/__pycache__/__init__.cpython-310.pyc and b/model_lib/__pycache__/__init__.cpython-310.pyc differ
|
|
model_lib/__pycache__/__init__.cpython-39.pyc
CHANGED
Binary files a/model_lib/__pycache__/__init__.cpython-39.pyc and b/model_lib/__pycache__/__init__.cpython-39.pyc differ
|
|
model_lib/__pycache__/attention_processor.cpython-310.pyc
CHANGED
Binary files a/model_lib/__pycache__/attention_processor.cpython-310.pyc and b/model_lib/__pycache__/attention_processor.cpython-310.pyc differ
|
|
model_lib/__pycache__/moMA_generator.cpython-310.pyc
CHANGED
Binary files a/model_lib/__pycache__/moMA_generator.cpython-310.pyc and b/model_lib/__pycache__/moMA_generator.cpython-310.pyc differ
|
|
model_lib/__pycache__/moMA_generator.cpython-39.pyc
CHANGED
Binary files a/model_lib/__pycache__/moMA_generator.cpython-39.pyc and b/model_lib/__pycache__/moMA_generator.cpython-39.pyc differ
|
|
model_lib/__pycache__/modules.cpython-310.pyc
CHANGED
Binary files a/model_lib/__pycache__/modules.cpython-310.pyc and b/model_lib/__pycache__/modules.cpython-310.pyc differ
|
|
model_lib/__pycache__/modules.cpython-39.pyc
CHANGED
Binary files a/model_lib/__pycache__/modules.cpython-39.pyc and b/model_lib/__pycache__/modules.cpython-39.pyc differ
|
|
model_lib/__pycache__/utils.cpython-310.pyc
CHANGED
Binary files a/model_lib/__pycache__/utils.cpython-310.pyc and b/model_lib/__pycache__/utils.cpython-310.pyc differ
|
|