Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,9 @@ import streamlit as st
|
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
from io import BytesIO
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def create_blake_image(input_image):
|
| 7 |
# Read the image from the BytesIO object
|
|
@@ -21,13 +24,21 @@ def create_blake_image(input_image):
|
|
| 21 |
|
| 22 |
return result
|
| 23 |
|
| 24 |
-
st.title("Blake-Style Image Converter")
|
| 25 |
-
picture = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
|
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
from io import BytesIO
|
| 5 |
+
from streamlit_webrtc import webrtc_streamer
|
| 6 |
+
from turn import get_ice_servers
|
| 7 |
+
import av
|
| 8 |
|
| 9 |
def create_blake_image(input_image):
|
| 10 |
# Read the image from the BytesIO object
|
|
|
|
| 24 |
|
| 25 |
return result
|
| 26 |
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
|
| 29 |
+
# Continue with the rest of your processing
|
| 30 |
+
|
| 31 |
+
class VideoProcessor:
|
| 32 |
+
num_bins = 256
|
| 33 |
+
video_stopped = False
|
| 34 |
|
| 35 |
+
def recv(self, frame):
|
| 36 |
+
frm = frame.to_ndarray(format="bgr24")
|
| 37 |
+
frm = cv2.flip(frm,1)
|
| 38 |
+
modified_frm = create_blake_image(frm)
|
| 39 |
+
return av.VideoFrame.from_ndarray(modified_frm , format='bgr24')
|
| 40 |
+
# Inside your Streamlit app
|
| 41 |
+
|
| 42 |
+
st.title("التركيز على وسط الشاشة")
|
| 43 |
|
| 44 |
+
webrtc_streamer(key="example", video_processor_factory=VideoProcessor,media_stream_constraints={"video": True, "audio": False},rtc_configuration={"iceServers": get_ice_servers()},)
|