import google.generativeai as genai from dotenv import load_dotenv import os import time load_dotenv() GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") genai.configure(api_key=GOOGLE_API_KEY) code_model = genai.GenerativeModel('gemini-1.5-flash') # Function to analyze video and audio together def analyze_with_audio_video(video_file, audio_file): # Upload the video and audio files my_video_file = genai.upload_file(path=video_file) my_audio_file = genai.upload_file(path=audio_file) while my_video_file.state.name == "PROCESSING" or my_audio_file.state.name == "PROCESSING": time.sleep(5) my_video_file = genai.get_file(my_video_file.name) my_audio_file = genai.get_file(my_audio_file.name) # Example prompt directly referencing user issues prompt = f""" The user is reporting an error in the code. Analyze the video '{my_video_file.name}' along with the audio '{my_audio_file.name}'. Get the issue from the audio file and refer it to the video file and provide the solution 1. **Explanation of the Error**: Pinpoint the error mentioned by the user. 2. **Approach to Solve the Error**: Provide a step-by-step guide to resolve the error, using both video and audio data. 3. **Corrected Code**: Provide the corrected code, addressing the identified error. 4. **Summary**: Summarize the solution, ensuring clarity on how the error was fixed. """ # Request content generation from Gemini model response = code_model.generate_content([my_video_file, my_audio_file, prompt]) return response.text