Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,37 +55,18 @@ def prime_factors(n):
|
|
55 |
factors.append(n)
|
56 |
return factors
|
57 |
|
58 |
-
def generate_cheetah_image():
|
59 |
-
return Path(os.path.dirname(__file__)) / "cheetah.jpg"
|
60 |
-
|
61 |
-
def image_orientation(image: Image.Image) -> str:
|
62 |
-
return "Portrait" if image.height > image.width else "Landscape"
|
63 |
-
|
64 |
-
def sepia(input_img):
|
65 |
-
sepia_filter = np.array([
|
66 |
-
[0.393, 0.769, 0.189],
|
67 |
-
[0.349, 0.686, 0.168],
|
68 |
-
[0.272, 0.534, 0.131]
|
69 |
-
])
|
70 |
-
sepia_img = np.array(input_img).dot(sepia_filter.T)
|
71 |
-
sepia_img /= sepia_img.max()
|
72 |
-
return sepia_img
|
73 |
|
74 |
# Tabbed Tool Interface
|
75 |
demo = gr.TabbedInterface(
|
76 |
[
|
77 |
gr.Interface(search_youtube, gr.Textbox(label="YouTube Query"), gr.Textbox(label="Top 5 Results"), api_name="youtube_search"),
|
78 |
gr.Interface(prime_factors, gr.Textbox(), gr.Textbox(), api_name="prime_factors"),
|
79 |
-
|
80 |
-
gr.Interface(image_orientation, gr.Image(type="pil"), gr.Textbox(), api_name="image_orientation"),
|
81 |
-
gr.Interface(sepia, gr.Image(), gr.Image(), api_name="sepia"),
|
82 |
],
|
83 |
[
|
84 |
"YouTube Search",
|
85 |
"Prime Factors",
|
86 |
-
|
87 |
-
"Image Orientation Checker",
|
88 |
-
"Sepia Filter",
|
89 |
]
|
90 |
)
|
91 |
|
|
|
55 |
factors.append(n)
|
56 |
return factors
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
# Tabbed Tool Interface
|
60 |
demo = gr.TabbedInterface(
|
61 |
[
|
62 |
gr.Interface(search_youtube, gr.Textbox(label="YouTube Query"), gr.Textbox(label="Top 5 Results"), api_name="youtube_search"),
|
63 |
gr.Interface(prime_factors, gr.Textbox(), gr.Textbox(), api_name="prime_factors"),
|
64 |
+
|
|
|
|
|
65 |
],
|
66 |
[
|
67 |
"YouTube Search",
|
68 |
"Prime Factors",
|
69 |
+
|
|
|
|
|
70 |
]
|
71 |
)
|
72 |
|