Spaces:
Sleeping
Sleeping
add text as input
Browse files
app.py
CHANGED
|
@@ -46,18 +46,20 @@ def move_circle(img: np.ndarray, x: int = 100, y: int = 100) -> np.ndarray:
|
|
| 46 |
return out
|
| 47 |
|
| 48 |
|
| 49 |
-
def remove_caps(txt_in: str = "TUTU") -> str:
|
| 50 |
-
return txt_in.lower()
|
|
|
|
|
|
|
| 51 |
# Pipeline definition
|
| 52 |
# -------------------
|
| 53 |
|
| 54 |
|
| 55 |
-
def pipe(inp: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
|
| 56 |
out = add_extra_caption(inp)
|
| 57 |
out = processing_block(out)
|
| 58 |
out = draw_text(out)
|
| 59 |
out = move_circle(out)
|
| 60 |
-
txt_out = remove_caps()
|
| 61 |
return inp, out, txt_out
|
| 62 |
|
| 63 |
# Add interactivity to the processing blocks
|
|
@@ -102,7 +104,7 @@ def launch(img: np.ndarray, backend: str = "gradio", markdown_description: str =
|
|
| 102 |
cache=True,
|
| 103 |
markdown_description=markdown_description
|
| 104 |
)(pipe)
|
| 105 |
-
pipe_interactive(img)
|
| 106 |
|
| 107 |
|
| 108 |
if __name__ == "__main__":
|
|
|
|
| 46 |
return out
|
| 47 |
|
| 48 |
|
| 49 |
+
def remove_caps(txt_prefix: str, txt_in: str = "TUTU") -> str:
|
| 50 |
+
return txt_prefix + "\n" + txt_in.lower()
|
| 51 |
+
|
| 52 |
+
|
| 53 |
# Pipeline definition
|
| 54 |
# -------------------
|
| 55 |
|
| 56 |
|
| 57 |
+
def pipe(inp: np.ndarray, txt_prefix) -> Tuple[np.ndarray, np.ndarray]:
|
| 58 |
out = add_extra_caption(inp)
|
| 59 |
out = processing_block(out)
|
| 60 |
out = draw_text(out)
|
| 61 |
out = move_circle(out)
|
| 62 |
+
txt_out = remove_caps(txt_prefix)
|
| 63 |
return inp, out, txt_out
|
| 64 |
|
| 65 |
# Add interactivity to the processing blocks
|
|
|
|
| 104 |
cache=True,
|
| 105 |
markdown_description=markdown_description
|
| 106 |
)(pipe)
|
| 107 |
+
pipe_interactive(img, "REMOVE CAPS! ")
|
| 108 |
|
| 109 |
|
| 110 |
if __name__ == "__main__":
|