Strata7 commited on
Commit
b1c4202
·
verified ·
1 Parent(s): db9b8e3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +108 -0
app.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Define questions and options
4
+ questions = [
5
+ {
6
+ "question": "What type of projects excites you the most?",
7
+ "options": [
8
+ ("Building and coding software that can solve real-world problems.", "Computer Engineering, Cybersecurity, Embedded & IoT Systems"),
9
+ ("Designing stunning graphics, animations, and immersive worlds.", "Animation & Games Design, Animation Multimedia & VFX, Visual Communication"),
10
+ ("Creating products that incorporate futuristic technologies like AI or IoT.", "Drone, AR/VR, Embedded & IoT Systems"),
11
+ ("Crafting campaigns that help brands connect with people worldwide.", "Digital Marketing & E-Commerce, Fashion Technology"),
12
+ ("Producing music, films, or shows that captivate an audience.", "Audio & Sound Production, Film & OTT Production")
13
+ ]
14
+ },
15
+ {
16
+ "question": "What’s your favorite way to learn something new?",
17
+ "options": [
18
+ ("Experimenting with gadgets and doing hands-on projects.", "Embedded & IoT Systems, Drone, Computer Engineering"),
19
+ ("Watching documentaries, films, or exploring visual storytelling.", "Film & OTT Production, Visual Communication, Animation Multimedia & VFX"),
20
+ ("Attending tech or gaming conventions and learning about new trends.", "AR/VR, Animation & Games Design, Cybersecurity"),
21
+ ("Reading about the latest fashion, business, or digital trends.", "Digital Marketing & E-Commerce, Fashion Technology"),
22
+ ("Engaging with DIY projects that improve everyday life, like gardening or tech setups.", "Hydroponics, Futuristic Skill-Based Programs")
23
+ ]
24
+ },
25
+ {
26
+ "question": "Which scenario sounds most exciting to you?",
27
+ "options": [
28
+ ("Designing a cybersecurity system to protect a company’s data.", "Cybersecurity, Embedded & IoT Systems"),
29
+ ("Creating an animated short film that could go viral.", "Animation Multimedia & VFX, Animation & Games Design, Visual Communication"),
30
+ ("Developing a fashion brand that combines creativity with sustainability.", "Fashion Technology, Digital Marketing & E-Commerce"),
31
+ ("Leading a project that uses VR to simulate real-life situations for training purposes.", "AR/VR, Visual Communication"),
32
+ ("Producing a hit single or an award-winning movie.", "Audio & Sound Production, Film & OTT Production")
33
+ ]
34
+ },
35
+ {
36
+ "question": "How do you like to solve problems?",
37
+ "options": [
38
+ ("By designing and testing prototypes until they work.", "Drone, Computer Engineering, Embedded & IoT Systems"),
39
+ ("Through creativity and visual storytelling.", "Visual Communication, Animation & Games Design, Film & OTT Production"),
40
+ ("By analyzing market trends and finding innovative ways to reach audiences.", "Digital Marketing & E-Commerce, Fashion Technology"),
41
+ ("By combining practical knowledge with cutting-edge technology.", "AR/VR, Hydroponics, Futuristic Skill-Based Programs"),
42
+ ("By exploring soundscapes and experimenting with new media.", "Audio & Sound Production, Animation Multimedia & VFX")
43
+ ]
44
+ },
45
+ {
46
+ "question": "Pick an environment you’d thrive in.",
47
+ "options": [
48
+ ("A high-tech lab or office filled with gadgets and computers.", "Cybersecurity, Computer Engineering, Embedded & IoT Systems"),
49
+ ("A studio where creativity flows, with easels, green screens, and VR headsets.", "Animation Multimedia & VFX, AR/VR, Visual Communication"),
50
+ ("A trendy office space buzzing with creative minds and brand discussions.", "Digital Marketing & E-Commerce, Fashion Technology"),
51
+ ("An outdoor space where you work with plants, tech, and new sustainable methods.", "Hydroponics, Futuristic Skill-Based Programs"),
52
+ ("A recording studio or film set, where you bring stories to life with sound and visuals.", "Audio & Sound Production, Film & OTT Production")
53
+ ]
54
+ }
55
+ ]
56
+
57
+ # Store results
58
+ results = {
59
+ "Computer Engineering": 0,
60
+ "Cybersecurity": 0,
61
+ "Embedded & IoT Systems": 0,
62
+ "Drone": 0,
63
+ "Animation & Games Design": 0,
64
+ "Animation Multimedia & VFX": 0,
65
+ "Visual Communication": 0,
66
+ "AR/VR": 0,
67
+ "Digital Marketing & E-Commerce": 0,
68
+ "Fashion Technology": 0,
69
+ "Hydroponics": 0,
70
+ "Audio & Sound Production": 0,
71
+ "Film & OTT Production": 0,
72
+ "Futuristic Skill-Based Programs": 0
73
+ }
74
+
75
+ # Define quiz logic
76
+ def quiz_responses(answers):
77
+ # Reset results
78
+ for key in results:
79
+ results[key] = 0
80
+
81
+ # Process answers and tally scores
82
+ for i, answer in enumerate(answers):
83
+ selected_option = questions[i]["options"][int(answer)][1].split(", ")
84
+ for program in selected_option:
85
+ results[program] += 1
86
+
87
+ # Sort and display top recommended programs
88
+ sorted_results = sorted(results.items(), key=lambda x: x[1], reverse=True)
89
+ top_recommendations = [f"{program} ({count} matches)" for program, count in sorted_results if count > 0]
90
+
91
+ return "Top Recommended Programs for You:\n" + "\n".join(top_recommendations[:3])
92
+
93
+ # Create Gradio interface
94
+ def create_interface():
95
+ question_inputs = [gr.inputs.Radio([option[0] for option in question["options"]], label=question["question"]) for question in questions]
96
+
97
+ # Use Gradio's Interface function
98
+ return gr.Interface(
99
+ fn=quiz_responses,
100
+ inputs=question_inputs,
101
+ outputs="text",
102
+ title="RISAYA Global - What's Your Career Path?",
103
+ description="Discover the perfect program for your career path at RISAYA Academy! Answer a few questions, and we’ll recommend the best programs tailored to your interests."
104
+ )
105
+
106
+ # Run the interface
107
+ quiz_interface = create_interface()
108
+ quiz_interface.launch()