Sayandip commited on
Commit
35c7d0d
·
verified ·
1 Parent(s): 081107a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -62
app.py CHANGED
@@ -12,7 +12,6 @@ from reportlab.lib.styles import getSampleStyleSheet
12
  from bs4 import BeautifulSoup
13
  import re
14
  import base64
15
- import uuid
16
 
17
  # Set Gemini API Key
18
  client = genai.Client(api_key=os.environ.get("GEMINI_API_KEY"))
@@ -114,7 +113,6 @@ def main():
114
  if "chat_history" not in st.session_state:
115
  st.session_state.chat_history = []
116
 
117
- # File Uploader
118
  uploaded_files = st.file_uploader(
119
  "Upload files (.txt, .docx, .csv, .xlsx, .pptx, .pdf, .html, .htm, .tex, .jpg, .jpeg, .png, video formats):",
120
  type=[
@@ -161,66 +159,6 @@ def main():
161
 
162
  st.session_state.documents_text = all_text_content
163
 
164
- # Image Capture (Webcam)
165
- image = st.camera_input("Take a picture")
166
- if image is not None:
167
- st.image(image)
168
- # Process image here if necessary
169
- st.session_state.image_data = process_image(image)
170
-
171
- # Video Capture (Start/Stop Recording)
172
- video_recorder_html = """
173
- <html>
174
- <head>
175
- <script>
176
- let mediaRecorder;
177
- let recordedChunks = [];
178
-
179
- function startRecording() {
180
- navigator.mediaDevices.getUserMedia({ video: true, audio: true })
181
- .then(stream => {
182
- const videoElement = document.getElementById("videoPreview");
183
- videoElement.srcObject = stream;
184
-
185
- mediaRecorder = new MediaRecorder(stream);
186
- mediaRecorder.ondataavailable = (event) => recordedChunks.push(event.data);
187
- mediaRecorder.onstop = () => {
188
- const blob = new Blob(recordedChunks, { type: "video/webm" });
189
- const url = URL.createObjectURL(blob);
190
- const downloadLink = document.getElementById("downloadLink");
191
- downloadLink.href = url;
192
- downloadLink.download = "recorded_video_" + Math.random().toString(36).substring(7) + ".webm";
193
- document.getElementById("videoControls").style.display = "block";
194
- };
195
- mediaRecorder.start();
196
- document.getElementById("startButton").style.display = "none";
197
- document.getElementById("stopButton").style.display = "inline-block";
198
- })
199
- .catch(error => console.error("Error accessing media devices.", error));
200
- }
201
-
202
- function stopRecording() {
203
- mediaRecorder.stop();
204
- document.getElementById("startButton").style.display = "inline-block";
205
- document.getElementById("stopButton").style.display = "none";
206
- }
207
- </script>
208
- </head>
209
- <body>
210
- <h3>Capture Video</h3>
211
- <video id="videoPreview" width="320" height="240" autoplay></video><br/>
212
- <button id="startButton" onclick="startRecording()">Start Recording</button>
213
- <button id="stopButton" style="display:none;" onclick="stopRecording()">Stop Recording</button>
214
- <div id="videoControls" style="display:none;">
215
- <a id="downloadLink">Download Video</a>
216
- </div>
217
- </body>
218
- </html>
219
- """
220
-
221
- # Render the video recorder HTML in Streamlit
222
- st.components.v1.html(video_recorder_html)
223
-
224
  if st.session_state.documents_text:
225
  st.markdown("### \U0001F4AC Conversation")
226
  for user_q, gemini_a in st.session_state.conversation:
 
12
  from bs4 import BeautifulSoup
13
  import re
14
  import base64
 
15
 
16
  # Set Gemini API Key
17
  client = genai.Client(api_key=os.environ.get("GEMINI_API_KEY"))
 
113
  if "chat_history" not in st.session_state:
114
  st.session_state.chat_history = []
115
 
 
116
  uploaded_files = st.file_uploader(
117
  "Upload files (.txt, .docx, .csv, .xlsx, .pptx, .pdf, .html, .htm, .tex, .jpg, .jpeg, .png, video formats):",
118
  type=[
 
159
 
160
  st.session_state.documents_text = all_text_content
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  if st.session_state.documents_text:
163
  st.markdown("### \U0001F4AC Conversation")
164
  for user_q, gemini_a in st.session_state.conversation: