Joanna30 commited on
Commit
b8668ba
·
verified ·
1 Parent(s): 4c9fc4e

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +12 -2
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: {sn
 
 
 
 
 
 
 
 
 
 
 
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