Spaces:
Build error
Build error
Liangyu
commited on
Commit
Β·
6a18dcc
1
Parent(s):
1d068c5
cleaned code
Browse files- app.py +0 -5
- fake_gan.py +0 -56
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
#!/usr/bin/env python
|
2 |
-
|
3 |
from __future__ import annotations
|
4 |
|
5 |
import argparse
|
@@ -44,9 +42,6 @@ Check out our [GitHub repo](https://github.com/Jingkang50/OpenPSG) and [official
|
|
44 |
<img id="visualzation" src="https://github.com/Jingkang50/OpenPSG/blob/main/assets/psgtr_long.gif?raw=true" alt="visualzation" style="width:100%">
|
45 |
</div>
|
46 |
</div>
|
47 |
-
|
48 |
-
Inference takes about 10 second per image.
|
49 |
-
|
50 |
'''
|
51 |
FOOTER = '<img id="visitor-badge" src="https://visitor-badge.glitch.me/badge?page_id=c-liangyu.openpsg" alt="visitor badge" />'
|
52 |
|
|
|
|
|
|
|
1 |
from __future__ import annotations
|
2 |
|
3 |
import argparse
|
|
|
42 |
<img id="visualzation" src="https://github.com/Jingkang50/OpenPSG/blob/main/assets/psgtr_long.gif?raw=true" alt="visualzation" style="width:100%">
|
43 |
</div>
|
44 |
</div>
|
|
|
|
|
|
|
45 |
'''
|
46 |
FOOTER = '<img id="visitor-badge" src="https://visitor-badge.glitch.me/badge?page_id=c-liangyu.openpsg" alt="visitor badge" />'
|
47 |
|
fake_gan.py
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
# another demo
|
2 |
-
# https://huggingface.co/spaces/dalle-mini/dalle-mini/blob/21944e2a8508568387951fc66a30e90f1d58819d/app/gradio/app.py
|
3 |
-
|
4 |
-
# This demo needs to be run from the repo folder.
|
5 |
-
# python demo/fake_gan/run.py
|
6 |
-
import os
|
7 |
-
import random
|
8 |
-
import time
|
9 |
-
|
10 |
-
import gradio as gr
|
11 |
-
|
12 |
-
|
13 |
-
def fake_gan(count, *args):
|
14 |
-
time.sleep(1)
|
15 |
-
images = [
|
16 |
-
random.choice(
|
17 |
-
[
|
18 |
-
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
19 |
-
"https://images.unsplash.com/photo-1554151228-14d9def656e4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=386&q=80",
|
20 |
-
"https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8aHVtYW4lMjBmYWNlfGVufDB8fDB8fA%3D%3D&w=1000&q=80",
|
21 |
-
"https://images.unsplash.com/photo-1546456073-92b9f0a8d413?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
22 |
-
"https://images.unsplash.com/photo-1601412436009-d964bd02edbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80",
|
23 |
-
]
|
24 |
-
)
|
25 |
-
for _ in range(int(count))
|
26 |
-
]
|
27 |
-
return images
|
28 |
-
|
29 |
-
|
30 |
-
cheetah = os.path.join(os.path.dirname(__file__), "files/cheetah1.jpg")
|
31 |
-
|
32 |
-
demo = gr.Interface(
|
33 |
-
fn=fake_gan,
|
34 |
-
inputs=[
|
35 |
-
gr.Number(label="Generation Count"),
|
36 |
-
gr.Image(label="Initial Image (optional)"),
|
37 |
-
gr.Slider(0, 50, 25, label="TV_scale (for smoothness)"),
|
38 |
-
gr.Slider(0, 50, 25, label="Range_Scale (out of range RBG)"),
|
39 |
-
gr.Number(label="Seed"),
|
40 |
-
gr.Number(label="Respacing"),
|
41 |
-
],
|
42 |
-
outputs=gr.Gallery(label="Generated Images"),
|
43 |
-
title="FD-GAN",
|
44 |
-
description="This is a fake demo of a GAN. In reality, the images are randomly chosen from Unsplash.",
|
45 |
-
examples=[
|
46 |
-
[2, cheetah, 12, None, None, None],
|
47 |
-
[1, cheetah, 2, None, None, None],
|
48 |
-
[4, cheetah, 42, None, None, None],
|
49 |
-
[5, cheetah, 23, None, None, None],
|
50 |
-
[4, cheetah, 11, None, None, None],
|
51 |
-
[3, cheetah, 1, None, None, None],
|
52 |
-
],
|
53 |
-
)
|
54 |
-
|
55 |
-
if __name__ == "__main__":
|
56 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|