Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
import time
|
3 |
-
from serpapi import GoogleSearch
|
4 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.prompts import PromptTemplate
|
@@ -54,4 +54,14 @@ def generate_script(prompt, video_length, creativity, api_key):
|
|
54 |
# Ensure that the search data has valid title and snippet
|
55 |
if title_result and snippet_result:
|
56 |
script += f"{index + 1}. {title_result}.\n"
|
57 |
-
script += f" - Key Insights: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import time
|
3 |
+
from serpapi import GoogleSearch # Corrected import
|
4 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
5 |
from langchain.chains import LLMChain
|
6 |
from langchain.prompts import PromptTemplate
|
|
|
54 |
# Ensure that the search data has valid title and snippet
|
55 |
if title_result and snippet_result:
|
56 |
script += f"{index + 1}. {title_result}.\n"
|
57 |
+
script += f" - Key Insights: {snippet_result}\n\n" # Fixed: correctly closed string here
|
58 |
+
else:
|
59 |
+
script += f"{index + 1}. No valid data available.\n"
|
60 |
+
else:
|
61 |
+
script += "No search data available to generate key points.\n"
|
62 |
+
|
63 |
+
# Add a conclusion to the script
|
64 |
+
script += f"**Conclusion:**\n"
|
65 |
+
script += f"Host: 'We hope you found these tips helpful! Don’t forget to like, share, and subscribe for more content. See you in the next video!'\n"
|
66 |
+
|
67 |
+
return title, script, search_data
|