Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,15 +35,15 @@ def get_caption(image_in):
|
|
35 |
print("Unable to locate valid description.")
|
36 |
|
37 |
# Find the last occurrence of "."
|
38 |
-
|
39 |
|
40 |
# Truncate the string up to the last period
|
41 |
-
|
42 |
|
43 |
# print(truncated_caption)
|
44 |
-
|
45 |
|
46 |
-
return
|
47 |
|
48 |
def get_magnet(prompt):
|
49 |
amended_prompt = f"High quality sound effects. {prompt}"
|
|
|
35 |
print("Unable to locate valid description.")
|
36 |
|
37 |
# Find the last occurrence of "."
|
38 |
+
last_period_index = description.rfind('.')
|
39 |
|
40 |
# Truncate the string up to the last period
|
41 |
+
truncated_caption = description[:last_period_index + 1]
|
42 |
|
43 |
# print(truncated_caption)
|
44 |
+
print(f"\n—\nIMAGE CAPTION: {truncated_caption}")
|
45 |
|
46 |
+
return truncated_caption
|
47 |
|
48 |
def get_magnet(prompt):
|
49 |
amended_prompt = f"High quality sound effects. {prompt}"
|