-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic_usage.py
41 lines (34 loc) · 1.43 KB
/
basic_usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from scraperly import ContentProcessor
import json
def main():
# Example content
content = """
In the realm of artificial intelligence, innovation knows no bounds.
Each day brings new breakthroughs, pushing the boundaries of what's possible.
From machine learning to neural networks, the future is being shaped by code.
"""
try:
# Initialize processor with your API key
processor = ContentProcessor(
provider_name="hyperbolic",
api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZGVsNTBhbGk1MEBnbWFpbC5jb20iLCJpYXQiOjE3Mzg1MTE1Mzd9.q3lmzpYKd5EZTaN2YOf6wKwwUTqAWafcphte5oClzQk",
max_images_per_segment=3
)
# Process the content
print("Processing content...")
processed_segments = processor.process_content(content)
# Save results with audio and timing information
print("Saving results...")
processor.save_processed_content(processed_segments, "processed_content.json")
# Create video with captions
print("Creating video...")
processor.create_video("processed_content.json", "output_with_captions.mp4")
except Exception as e:
print(f"Error in main: {str(e)}")
import traceback
traceback.print_exc()
finally:
if 'processor' in locals():
processor.scraper.close()
if __name__ == "__main__":
main()