Spaces:
Sleeping
Sleeping
File size: 3,439 Bytes
b490ee7 | 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | """Example data for the movie predictor."""
from __future__ import annotations
from typing import Any
def get_example_data(feature_options: dict[str, list[str]]) -> list[list[Any]]:
"""Generate example movie data for quick testing."""
genres = feature_options.get("genres", [])[:3]
companies = feature_options.get("production_companies", [])[:2]
keywords = feature_options.get("Keywords", [])[:3]
cast = feature_options.get("cast", [])[:2]
return [
[
# Blockbuster Example (similar to Avengers-type movies)
200_000_000, # budget
64.0, # popularity
143, # runtime
"2019-04-26", # release_date
"en", # original_language
True, # belongs_to_collection
True, # homepage
"The Final Showdown", # title
"Whatever it takes", # tagline
"After devastating events, heroes must assemble once more to undo chaos and restore order to the universe.", # overview
25, # num_of_cast
50, # num_of_crew
8, # gender_cast_1 (female)
15, # gender_cast_2 (male)
2, # count_cast_other
genres[:3] if len(genres) >= 3 else genres, # genres
companies[:2] if len(companies) >= 2 else companies, # production_companies
keywords[:5] if len(keywords) >= 5 else keywords, # keywords
cast[:5] if len(cast) >= 5 else cast, # cast
],
[
# Mid-Budget Comedy
40_000_000, # budget
8.2, # popularity
113, # runtime
"2015-08-06", # release_date
"en", # original_language
True, # belongs_to_collection
True, # homepage
"Royal Wedding", # title
"Royalty has its responsibilities", # tagline
"A young princess must navigate royal duties while finding true love before her coronation.", # overview
20, # num_of_cast
30, # num_of_crew
12, # gender_cast_1 (female)
8, # gender_cast_2 (male)
0, # count_cast_other
genres[:2] if len(genres) >= 2 else genres, # genres
companies[:1] if companies else [], # production_companies
keywords[:3] if len(keywords) >= 3 else keywords, # keywords
cast[:3] if len(cast) >= 3 else cast, # cast
],
[
# Low-Budget Thriller
3_300_000, # budget
35.0, # popularity
105, # runtime
"2014-10-10", # release_date
"en", # original_language
False, # belongs_to_collection
True, # homepage
"Perfect Rhythm", # title
"Greatness comes at a price", # tagline
"A talented musician pushes beyond limits under the guidance of a demanding instructor.", # overview
15, # num_of_cast
25, # num_of_crew
3, # gender_cast_1 (female)
10, # gender_cast_2 (male)
2, # count_cast_other
genres[:1] if genres else [], # genres
companies[:2] if len(companies) >= 2 else companies, # production_companies
keywords[:4] if len(keywords) >= 4 else keywords, # keywords
cast[:2] if len(cast) >= 2 else cast, # cast
],
]
|