PRIYANSHUDHAKED commited on
Commit
256df3b
·
verified ·
1 Parent(s): b979b93

Update gemini_vision.py

Browse files
Files changed (1) hide show
  1. gemini_vision.py +2 -25
gemini_vision.py CHANGED
@@ -9,7 +9,7 @@ import cv2
9
  import os
10
  import google.generativeai as genai
11
 
12
- os.environ["GOOGLE_API_KEY"] = "AIzaSyD0GxR2J1JxGic807Cc89Jq6MB4aDJYgDc"
13
  genai.configure()
14
  # Configure the Gemini API
15
  # Initialize the Gemini Vision Pro model
@@ -48,27 +48,4 @@ def process_frame_with_gemini(frame, mode="image"):
48
  if mode == "image":
49
  prompt = ["Describe the content of this frame", image]
50
  else:
51
- prompt = ["Transcribe the audio file at this path", audio_path, image]
52
-
53
- # Call the API using retry logic
54
- response = retry_with_backoff(lambda: model.generate_content(prompt))
55
-
56
- return response.text
57
-
58
- def summarize_with_gemini(text, max_words):
59
- text_model = genai.GenerativeModel('gemini-pro')
60
- prompt = f"Summarize the following text in about {max_words} words: {text}"
61
-
62
- # Call the API using retry logic
63
- response = retry_with_backoff(lambda: text_model.generate_content(prompt))
64
-
65
- return response.text
66
-
67
- def extract_code_with_gemini(text):
68
- text_model = genai.GenerativeModel('gemini-pro')
69
- prompt = f"Extract and format any code snippets from the following text: {text}"
70
-
71
- # Call the API using retry logic
72
- response = retry_with_backoff(lambda: text_model.generate_content(prompt))
73
-
74
- return response.text
 
9
  import os
10
  import google.generativeai as genai
11
 
12
+ os.environ["GOOGLE_API_KEY"] = "AIzaSyBZlnycWrHm48hbf078cfQopvzpSQkmoOc"
13
  genai.configure()
14
  # Configure the Gemini API
15
  # Initialize the Gemini Vision Pro model
 
48
  if mode == "image":
49
  prompt = ["Describe the content of this frame", image]
50
  else:
51
+