Upload with huggingface_hub
Browse files
README.md
CHANGED
@@ -6,7 +6,6 @@ colorFrom: indigo
|
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.4.1
|
9 |
-
|
10 |
-
app_file: app.py
|
11 |
pinned: false
|
12 |
---
|
|
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.4.1
|
9 |
+
app_file: run.py
|
|
|
10 |
pinned: false
|
11 |
---
|
run.py
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This demo needs to be run from the repo folder.
|
2 |
+
# python demo/fake_gan/run.py
|
3 |
+
import os
|
4 |
+
import random
|
5 |
+
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
+
|
9 |
+
def fake_gan():
|
10 |
+
images = [
|
11 |
+
(random.choice(
|
12 |
+
[
|
13 |
+
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
14 |
+
"https://images.unsplash.com/photo-1554151228-14d9def656e4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=386&q=80",
|
15 |
+
"https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8aHVtYW4lMjBmYWNlfGVufDB8fDB8fA%3D%3D&w=1000&q=80",
|
16 |
+
"https://images.unsplash.com/photo-1546456073-92b9f0a8d413?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
|
17 |
+
"https://images.unsplash.com/photo-1601412436009-d964bd02edbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80",
|
18 |
+
]
|
19 |
+
), f"label {i}" if i != 0 else "label" * 50)
|
20 |
+
for i in range(3)
|
21 |
+
]
|
22 |
+
return images
|
23 |
+
|
24 |
+
|
25 |
+
with gr.Blocks() as demo:
|
26 |
+
with gr.Column(variant="panel"):
|
27 |
+
with gr.Row(variant="compact"):
|
28 |
+
text = gr.Textbox(
|
29 |
+
label="Enter your prompt",
|
30 |
+
show_label=False,
|
31 |
+
max_lines=1,
|
32 |
+
placeholder="Enter your prompt",
|
33 |
+
).style(
|
34 |
+
container=False,
|
35 |
+
)
|
36 |
+
btn = gr.Button("Generate image").style(full_width=False)
|
37 |
+
|
38 |
+
gallery = gr.Gallery(
|
39 |
+
label="Generated images", show_label=False, elem_id="gallery"
|
40 |
+
).style(grid=[2], height="auto")
|
41 |
+
|
42 |
+
btn.click(fake_gan, None, gallery)
|
43 |
+
|
44 |
+
if __name__ == "__main__":
|
45 |
+
demo.launch()
|