Spaces:
Running
Running
Commit
·
89fdfd7
1
Parent(s):
b53e56f
add examples
Browse files- app.py +1 -9
- examples/aim_interface.png +0 -0
- examples/esfahan_unsplash.jpeg +0 -0
- examples/source.md +4 -0
- requirements.txt +0 -1
app.py
CHANGED
|
@@ -1,18 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
from utils import *
|
| 4 |
import cv2
|
| 5 |
import numpy as np
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
import io
|
| 8 |
|
| 9 |
-
torch.hub.download_url_to_file(
|
| 10 |
-
'https://github.com/aalto-ui/aim/raw/aim2/backend/data/tests/input_values/wikipedia.org_website.png',
|
| 11 |
-
'wikipedia.org_website.png')
|
| 12 |
-
torch.hub.download_url_to_file(
|
| 13 |
-
'https://github.com/aalto-ui/aim/raw/aim2/backend/data/tests/input_values/aalto.fi_website.png',
|
| 14 |
-
'aalto.fi_website.png')
|
| 15 |
-
|
| 16 |
|
| 17 |
def inference(img, template, angel):
|
| 18 |
color_image = cv2.imread(img.name, cv2.IMREAD_COLOR)
|
|
@@ -43,7 +35,7 @@ def inference(img, template, angel):
|
|
| 43 |
title = 'Color Harmonization'
|
| 44 |
description = 'Compute Color Harmonization with Different Templates'
|
| 45 |
article = "<p style='text-align: center'></p>"
|
| 46 |
-
|
| 47 |
# css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
| 48 |
|
| 49 |
gr.Interface(
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from utils import *
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import io
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def inference(img, template, angel):
|
| 10 |
color_image = cv2.imread(img.name, cv2.IMREAD_COLOR)
|
|
|
|
| 35 |
title = 'Color Harmonization'
|
| 36 |
description = 'Compute Color Harmonization with Different Templates'
|
| 37 |
article = "<p style='text-align: center'></p>"
|
| 38 |
+
examples = [['./examples/aim_interface.png', "V", 25], ['./examples/esfahan_unsplash.jpeg', "I", 0]]
|
| 39 |
# css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
| 40 |
|
| 41 |
gr.Interface(
|
examples/aim_interface.png
ADDED
|
examples/esfahan_unsplash.jpeg
ADDED
|
examples/source.md
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"esfahan_unsplash.jpeg":"https://images.unsplash.com/photo-1591139308596-9b663fa6d0a0?ixlib=rb-1.2.1&w=1000&q=80",
|
| 3 |
+
"aim_interface.png":"https://interfacemetrics.aalto.fi/"
|
| 4 |
+
}
|
requirements.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
opencv-python-headless ~= 4.2.0.34
|
| 2 |
-
torch
|
| 3 |
gradio~=3.0.17
|
| 4 |
numpy~=1.21.6
|
| 5 |
matplotlib~=3.2.2
|
|
|
|
| 1 |
opencv-python-headless ~= 4.2.0.34
|
|
|
|
| 2 |
gradio~=3.0.17
|
| 3 |
numpy~=1.21.6
|
| 4 |
matplotlib~=3.2.2
|