subhan971 commited on
Commit
df23a81
·
verified ·
1 Parent(s): 8a78480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- if st.button("Capture Image from Webcam"):
82
- path = capture_from_webcam()
83
- if path:
84
- st.session_state.image_path = path
85
- st.image(path, caption="Captured Image", use_container_width=True)
 
 
 
 
 
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"):