Delete logic.py
Browse files
logic.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
import google.generativeai as genai
|
2 |
-
from dotenv import load_dotenv
|
3 |
-
import os
|
4 |
-
import time
|
5 |
-
|
6 |
-
load_dotenv()
|
7 |
-
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
8 |
-
genai.configure(api_key=GOOGLE_API_KEY)
|
9 |
-
|
10 |
-
code_model = genai.GenerativeModel('gemini-1.5-flash')
|
11 |
-
|
12 |
-
# Function to analyze video and audio together
|
13 |
-
def analyze_with_audio_video(video_file, audio_file):
|
14 |
-
# Upload the video and audio files
|
15 |
-
my_video_file = genai.upload_file(path=video_file)
|
16 |
-
my_audio_file = genai.upload_file(path=audio_file)
|
17 |
-
|
18 |
-
while my_video_file.state.name == "PROCESSING" or my_audio_file.state.name == "PROCESSING":
|
19 |
-
time.sleep(5)
|
20 |
-
my_video_file = genai.get_file(my_video_file.name)
|
21 |
-
my_audio_file = genai.get_file(my_audio_file.name)
|
22 |
-
|
23 |
-
# Example prompt directly referencing user issues
|
24 |
-
prompt = f"""
|
25 |
-
The user is reporting an error in the code. Analyze the video '{my_video_file.name}' along with the audio '{my_audio_file.name}'.
|
26 |
-
Get the issue from the audio file and refer it to the video file and provide the solution
|
27 |
-
1. **Explanation of the Error**: Pinpoint the error mentioned by the user.
|
28 |
-
2. **Approach to Solve the Error**: Provide a step-by-step guide to resolve the error, using both video and audio data.
|
29 |
-
3. **Corrected Code**: Provide the corrected code, addressing the identified error.
|
30 |
-
4. **Summary**: Summarize the solution, ensuring clarity on how the error was fixed.
|
31 |
-
"""
|
32 |
-
|
33 |
-
# Request content generation from Gemini model
|
34 |
-
response = code_model.generate_content([my_video_file, my_audio_file, prompt])
|
35 |
-
return response.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|