Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,12 +23,10 @@ def analyze_device_condition(video_file_path):
|
|
| 23 |
|
| 24 |
uploaded_file = None
|
| 25 |
try:
|
| 26 |
-
#
|
| 27 |
-
# The keyword argument is 'file', not 'file_path'.
|
| 28 |
print(f"Log: Uploading file: {video_file_path}...")
|
| 29 |
uploaded_file = client.files.upload(file=video_file_path)
|
| 30 |
print("Log: File uploaded successfully.")
|
| 31 |
-
# --- END OF CORRECTION ---
|
| 32 |
|
| 33 |
# Prepare the prompt
|
| 34 |
prompt = """
|
|
@@ -48,12 +46,15 @@ def analyze_device_condition(video_file_path):
|
|
| 48 |
# Call the API with the simplified contents list
|
| 49 |
contents = [uploaded_file, prompt]
|
| 50 |
|
|
|
|
|
|
|
| 51 |
print(f"Log: Sending request to model: {model_name}...")
|
| 52 |
response = client.models.generate_content(
|
| 53 |
model=f"models/{model_name}",
|
| 54 |
contents=contents,
|
| 55 |
-
|
| 56 |
)
|
|
|
|
| 57 |
|
| 58 |
# Parse the final JSON response
|
| 59 |
parsed_json = json.loads(response.text)
|
|
|
|
| 23 |
|
| 24 |
uploaded_file = None
|
| 25 |
try:
|
| 26 |
+
# Upload the file
|
|
|
|
| 27 |
print(f"Log: Uploading file: {video_file_path}...")
|
| 28 |
uploaded_file = client.files.upload(file=video_file_path)
|
| 29 |
print("Log: File uploaded successfully.")
|
|
|
|
| 30 |
|
| 31 |
# Prepare the prompt
|
| 32 |
prompt = """
|
|
|
|
| 46 |
# Call the API with the simplified contents list
|
| 47 |
contents = [uploaded_file, prompt]
|
| 48 |
|
| 49 |
+
# --- THIS IS THE CORRECTED LINE ---
|
| 50 |
+
# The keyword argument is 'config', not 'generation_config'.
|
| 51 |
print(f"Log: Sending request to model: {model_name}...")
|
| 52 |
response = client.models.generate_content(
|
| 53 |
model=f"models/{model_name}",
|
| 54 |
contents=contents,
|
| 55 |
+
config=generate_content_config,
|
| 56 |
)
|
| 57 |
+
# --- END OF CORRECTION ---
|
| 58 |
|
| 59 |
# Parse the final JSON response
|
| 60 |
parsed_json = json.loads(response.text)
|