Update app.py
Browse files
app.py
CHANGED
@@ -78,11 +78,16 @@ if option == "Upload Image":
|
|
78 |
st.image(path, caption="Uploaded Image", use_container_width=True)
|
79 |
|
80 |
elif option == "Capture from Webcam":
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
|
88 |
if "image_path" in st.session_state and st.button("Suggest Hindi Song"):
|
|
|
78 |
st.image(path, caption="Uploaded Image", use_container_width=True)
|
79 |
|
80 |
elif option == "Capture from Webcam":
|
81 |
+
st.write("📸 Use your device's camera:")
|
82 |
+
camera_photo = st.camera_input("Take a picture")
|
83 |
+
|
84 |
+
if camera_photo is not None:
|
85 |
+
# Save the captured image
|
86 |
+
path = f"captured_{uuid.uuid4().hex[:8]}.jpg"
|
87 |
+
with open(path, "wb") as f:
|
88 |
+
f.write(camera_photo.read())
|
89 |
+
st.session_state.image_path = path
|
90 |
+
st.image(path, caption="Captured Image", use_container_width=True)
|
91 |
|
92 |
|
93 |
if "image_path" in st.session_state and st.button("Suggest Hindi Song"):
|