Update app.py
Browse files
app.py
CHANGED
|
@@ -19,52 +19,52 @@ def main():
|
|
| 19 |
args = parser.parse_args()
|
| 20 |
|
| 21 |
# Launch the web UI if requested
|
| 22 |
-
if args.ui:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
# Otherwise, run the CLI version
|
| 28 |
-
try:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
-
except KeyboardInterrupt:
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
except Exception as e:
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|
| 70 |
main()
|
|
|
|
| 19 |
args = parser.parse_args()
|
| 20 |
|
| 21 |
# Launch the web UI if requested
|
| 22 |
+
# if args.ui:
|
| 23 |
+
print("Launching web UI...")
|
| 24 |
+
launch_ui()
|
| 25 |
+
return
|
| 26 |
|
| 27 |
# Otherwise, run the CLI version
|
| 28 |
+
# try:
|
| 29 |
+
# # Get API keys if not provided
|
| 30 |
+
# groq_key = args.groq_key
|
| 31 |
+
# if not groq_key and not os.environ.get("GROQ_API_KEY"):
|
| 32 |
+
# groq_key = getpass.getpass("Enter the Groq API key: ")
|
| 33 |
|
| 34 |
+
# tavily_key = args.tavily_key
|
| 35 |
+
# if not tavily_key and not os.environ.get("TAVILY_API_KEY"):
|
| 36 |
+
# tavily_key = getpass.getpass("Enter the Tavily API key: ")
|
| 37 |
|
| 38 |
+
# # Display the workflow graph
|
| 39 |
+
# print("Generating AI News Blog...")
|
| 40 |
|
| 41 |
+
# # Generate the blog
|
| 42 |
+
# blog_content = generate_ai_news_blog(groq_key, tavily_key, args.date)
|
| 43 |
|
| 44 |
+
# # Save to file if output path provided
|
| 45 |
+
# if args.output:
|
| 46 |
+
# with open(args.output, "w") as f:
|
| 47 |
+
# f.write(blog_content)
|
| 48 |
+
# print(f"Blog saved to {args.output}")
|
| 49 |
+
# else:
|
| 50 |
+
# # Otherwise, save to default file
|
| 51 |
+
# output_file = f"ai_news_blog_{datetime.now().strftime('%Y-%m-%d')}.md"
|
| 52 |
+
# with open(output_file, "w") as f:
|
| 53 |
+
# f.write(blog_content)
|
| 54 |
+
# print(f"Blog saved to {output_file}")
|
| 55 |
|
| 56 |
+
# # Try to display the blog if running in a notebook
|
| 57 |
+
# try:
|
| 58 |
+
# display_blog(blog_content)
|
| 59 |
+
# except:
|
| 60 |
+
# print("Blog generated successfully.")
|
| 61 |
|
| 62 |
+
# except KeyboardInterrupt:
|
| 63 |
+
# print("\nOperation cancelled by user.")
|
| 64 |
+
# sys.exit(0)
|
| 65 |
+
# except Exception as e:
|
| 66 |
+
# print(f"Error running the pipeline: {str(e)}")
|
| 67 |
+
# sys.exit(1)
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|
| 70 |
main()
|