Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ import time
|
|
| 7 |
|
| 8 |
|
| 9 |
st.set_page_config(page_title="Exness Tempering App by Adil Khan")
|
| 10 |
-
cover = cv2.imread("cover.png", cv2.IMREAD_UNCHANGED)
|
| 11 |
|
| 12 |
def overlay_image(background, overlay):
|
| 13 |
background_resized = cv2.resize(background, (overlay.shape[1], overlay.shape[0]))
|
|
@@ -18,10 +17,16 @@ def overlay_image(background, overlay):
|
|
| 18 |
|
| 19 |
def image_tempering_app():
|
| 20 |
st.title("Exness Image Tempering App")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
screenshot_image = st.file_uploader("Upload Screenshot Image", type=["jpg", "jpeg", "png"])
|
| 22 |
if screenshot_image:
|
| 23 |
file_bytes = np.asarray(bytearray(screenshot_image.read()), dtype=np.uint8)
|
| 24 |
-
image = cv2.imdecode(file_bytes, cv2.IMREAD_UNCHANGED)
|
|
|
|
| 25 |
|
| 26 |
with st.spinner("Processing Image..."):
|
| 27 |
result = overlay_image(image, cover)
|
|
@@ -31,13 +36,14 @@ def image_tempering_app():
|
|
| 31 |
|
| 32 |
st.download_button("Download Processed Image", data=open(temp_filename, "rb").read(), file_name="processed_image.png", mime="image/png")
|
| 33 |
|
| 34 |
-
def process_video(video_path, output_path):
|
| 35 |
cap = cv2.VideoCapture(video_path)
|
| 36 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 37 |
fps = int(cap.get(cv2.CAP_PROP_FPS))
|
| 38 |
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 39 |
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 40 |
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
|
|
| 41 |
out = cv2.VideoWriter(output_path, fourcc, fps, (cover.shape[1], cover.shape[0]))
|
| 42 |
|
| 43 |
progress_bar = st.progress(0)
|
|
@@ -69,6 +75,11 @@ def process_video(video_path, output_path):
|
|
| 69 |
|
| 70 |
def video_tempering_app():
|
| 71 |
st.title("Exness Video Tempering App")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
screenshot_video = st.file_uploader("Upload Screen Recording", type=["mp4"])
|
| 73 |
if screenshot_video:
|
| 74 |
temp_video = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
|
|
@@ -76,7 +87,7 @@ def video_tempering_app():
|
|
| 76 |
output_video = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4").name
|
| 77 |
|
| 78 |
with st.spinner("Processing video..."):
|
| 79 |
-
process_video(temp_video.name, output_video)
|
| 80 |
|
| 81 |
st.download_button("Download Processed Video", data=open(output_video, "rb").read(), file_name="processed_video.mp4", mime="video/mp4")
|
| 82 |
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
st.set_page_config(page_title="Exness Tempering App by Adil Khan")
|
|
|
|
| 10 |
|
| 11 |
def overlay_image(background, overlay):
|
| 12 |
background_resized = cv2.resize(background, (overlay.shape[1], overlay.shape[0]))
|
|
|
|
| 17 |
|
| 18 |
def image_tempering_app():
|
| 19 |
st.title("Exness Image Tempering App")
|
| 20 |
+
cover_option = st.selectbox("Select Image Type:", ["With Banner", "Without Banner"], index=0)
|
| 21 |
+
if cover_option == "Without Banner":
|
| 22 |
+
cover_value = "cover.png"
|
| 23 |
+
else:
|
| 24 |
+
cover_value = "cover2.png"
|
| 25 |
screenshot_image = st.file_uploader("Upload Screenshot Image", type=["jpg", "jpeg", "png"])
|
| 26 |
if screenshot_image:
|
| 27 |
file_bytes = np.asarray(bytearray(screenshot_image.read()), dtype=np.uint8)
|
| 28 |
+
image = cv2.imdecode(file_bytes, cv2.IMREAD_UNCHANGED)
|
| 29 |
+
cover = cv2.imread(cover_value, cv2.IMREAD_UNCHANGED)
|
| 30 |
|
| 31 |
with st.spinner("Processing Image..."):
|
| 32 |
result = overlay_image(image, cover)
|
|
|
|
| 36 |
|
| 37 |
st.download_button("Download Processed Image", data=open(temp_filename, "rb").read(), file_name="processed_image.png", mime="image/png")
|
| 38 |
|
| 39 |
+
def process_video(video_path, output_path, cover_value):
|
| 40 |
cap = cv2.VideoCapture(video_path)
|
| 41 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 42 |
fps = int(cap.get(cv2.CAP_PROP_FPS))
|
| 43 |
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 44 |
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 45 |
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
| 46 |
+
cover = cv2.imread(cover_value, cv2.IMREAD_UNCHANGED)
|
| 47 |
out = cv2.VideoWriter(output_path, fourcc, fps, (cover.shape[1], cover.shape[0]))
|
| 48 |
|
| 49 |
progress_bar = st.progress(0)
|
|
|
|
| 75 |
|
| 76 |
def video_tempering_app():
|
| 77 |
st.title("Exness Video Tempering App")
|
| 78 |
+
cover_option = st.selectbox("Select Video Type:", ["With Banner", "Without Banner"], index=0)
|
| 79 |
+
if cover_option == "Without Banner":
|
| 80 |
+
cover_value = "cover.png"
|
| 81 |
+
else:
|
| 82 |
+
cover_value = "cover2.png"
|
| 83 |
screenshot_video = st.file_uploader("Upload Screen Recording", type=["mp4"])
|
| 84 |
if screenshot_video:
|
| 85 |
temp_video = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
|
|
|
|
| 87 |
output_video = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4").name
|
| 88 |
|
| 89 |
with st.spinner("Processing video..."):
|
| 90 |
+
process_video(temp_video.name, output_video, cover_value)
|
| 91 |
|
| 92 |
st.download_button("Download Processed Video", data=open(output_video, "rb").read(), file_name="processed_video.mp4", mime="video/mp4")
|
| 93 |
|