Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,78 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from infer import infer_image, infer_video
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
demo = gr.TabbedInterface([tab_img, tab_vid], ["Image", "Video"])
|
| 25 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from infer import infer_image, infer_video
|
| 3 |
|
| 4 |
+
theme = gr.themes.Base(
|
| 5 |
+
primary_hue=gr.themes.colors.purple,
|
| 6 |
+
neutral_hue=gr.themes.colors.gray,
|
| 7 |
+
font=gr.themes.GoogleFont("DM Sans"),
|
| 8 |
+
).set(
|
| 9 |
+
body_background_fill="#0e0e0e",
|
| 10 |
+
body_background_fill_dark="#0e0e0e",
|
| 11 |
+
block_background_fill="#181818",
|
| 12 |
+
block_background_fill_dark="#181818",
|
| 13 |
+
block_border_color="#2a2a2a",
|
| 14 |
+
block_border_color_dark="#2a2a2a",
|
| 15 |
+
block_label_text_color="#888888",
|
| 16 |
+
block_label_text_color_dark="#888888",
|
| 17 |
+
block_title_text_color="#f0f0f0",
|
| 18 |
+
block_title_text_color_dark="#f0f0f0",
|
| 19 |
+
border_color_accent="#a855f7",
|
| 20 |
+
border_color_accent_dark="#a855f7",
|
| 21 |
+
button_primary_background_fill="#a855f7",
|
| 22 |
+
button_primary_background_fill_dark="#a855f7",
|
| 23 |
+
button_primary_background_fill_hover="#b87ef7",
|
| 24 |
+
button_primary_background_fill_hover_dark="#b87ef7",
|
| 25 |
+
button_primary_text_color="#ffffff",
|
| 26 |
+
button_primary_text_color_dark="#ffffff",
|
| 27 |
+
button_secondary_background_fill="#222222",
|
| 28 |
+
button_secondary_background_fill_dark="#222222",
|
| 29 |
+
button_secondary_border_color="#333333",
|
| 30 |
+
button_secondary_border_color_dark="#333333",
|
| 31 |
+
button_secondary_text_color="#f0f0f0",
|
| 32 |
+
button_secondary_text_color_dark="#f0f0f0",
|
| 33 |
+
input_background_fill="#181818",
|
| 34 |
+
input_background_fill_dark="#181818",
|
| 35 |
+
input_border_color="#333333",
|
| 36 |
+
input_border_color_dark="#333333",
|
| 37 |
+
input_placeholder_color="#555555",
|
| 38 |
+
input_placeholder_color_dark="#555555",
|
| 39 |
+
slider_color="#a855f7",
|
| 40 |
+
slider_color_dark="#a855f7",
|
| 41 |
+
checkbox_background_color="#181818",
|
| 42 |
+
checkbox_background_color_dark="#181818",
|
| 43 |
+
checkbox_background_color_selected="#a855f7",
|
| 44 |
+
checkbox_background_color_selected_dark="#a855f7",
|
| 45 |
+
body_text_color="#f0f0f0",
|
| 46 |
+
body_text_color_dark="#f0f0f0",
|
| 47 |
+
body_text_color_subdued="#888888",
|
| 48 |
+
body_text_color_subdued_dark="#888888",
|
| 49 |
)
|
| 50 |
|
| 51 |
+
with gr.Blocks(theme=theme, title="Image Upscaler") as demo:
|
| 52 |
+
gr.Markdown("""
|
| 53 |
+
# ✦ Image Upscaler
|
| 54 |
+
Upscale images and videos using Real-ESRGAN AI
|
| 55 |
+
""")
|
| 56 |
+
|
| 57 |
+
with gr.Tabs():
|
| 58 |
+
with gr.TabItem("🖼 Image"):
|
| 59 |
+
with gr.Row():
|
| 60 |
+
with gr.Column():
|
| 61 |
+
img_input = gr.Image(type='pil', label='Select image')
|
| 62 |
+
img_scale = gr.Radio([2, 4, 8], value=4, label="Scale")
|
| 63 |
+
img_btn = gr.Button("✦ Upscale", variant="primary")
|
| 64 |
+
with gr.Column():
|
| 65 |
+
img_output = gr.Image(type="pil", label="Output Image")
|
| 66 |
+
img_btn.click(fn=infer_image, inputs=[img_input, img_scale], outputs=img_output)
|
| 67 |
+
|
| 68 |
+
with gr.TabItem("🎬 Video"):
|
| 69 |
+
with gr.Row():
|
| 70 |
+
with gr.Column():
|
| 71 |
+
vid_input = gr.Video(label='Select video')
|
| 72 |
+
vid_scale = gr.Radio([2, 4, 8], value=2, label="Scale")
|
| 73 |
+
vid_btn = gr.Button("✦ Upscale", variant="primary")
|
| 74 |
+
with gr.Column():
|
| 75 |
+
vid_output = gr.Video(label="Output Video")
|
| 76 |
+
vid_btn.click(fn=infer_video, inputs=[vid_input, vid_scale], outputs=vid_output)
|
| 77 |
|
|
|
|
| 78 |
demo.launch()
|