Sarath0x8f commited on
Commit
2058d70
ยท
verified ยท
1 Parent(s): e14fd07

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -0
app.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from GameMode import game_block
3
+ from UploadMode import upload_interface
4
+
5
+ # Detailed introduction and story for the application
6
+ intro = """
7
+ Dive into a world of stardom with two exciting modes of interaction: **Game Mode** and **Upload Mode**. Whether you want to challenge yourself with a fun game or simply upload a picture to identify celebrities, we've got you covered!
8
+
9
+ ### ๐Ÿš€ Modes of Interaction:
10
+
11
+ 1. **๐ŸŽฎ Game Mode** - Test your celebrity knowledge by identifying a specific target celebrity from a crowd. Guess correctly to win!
12
+ 2. **๐Ÿ“ค Upload Mode** - Upload any image containing celebrities, and our app will identify and display the names of those stars for you.
13
+
14
+ ### ๐ŸŒŸ List of Celebrities:
15
+ Akshay Kumar Alexandra Daddario Alia Bhatt Amitabh Bachchan Andy Samberg
16
+ Anushka Sharma Billie Eilish Brad Pitt Camila Cabello Charlize Theron
17
+ Claire Holt Courtney Cox Dwayne Johnson Elizabeth Olsen Ellen Degeneres
18
+ Henry Cavill Hrithik Roshan Hugh Jackman Jessica Alba Lisa Kudrow
19
+ Margot Robbie Natalie Portman Priyanka Chopra Robert Downey Jr Roger Federer
20
+ Tom Cruise Vijay Deverakonda Virat Kohli Zac Efron
21
+
22
+ **Note:** ๐Ÿ”„ *If you encounter an error, please refresh the page.*
23
+ """
24
+
25
+ # Detailed self-introduction and story for each mode
26
+ game_mode_intro = """
27
+ ## ๐ŸŽฎ Game Mode: The Celebrity Challenge
28
+ Upload an image of celebrity to win!
29
+
30
+ **Story**: ๐ŸŒŸ Imagine yourself at a star-studded Hollywood party surrounded by famous faces. Your mission is to find a specific celebrity among the crowd. Every round, a new target celebrity is chosen. Identify them correctly to win the round!
31
+
32
+ **How to Play**:
33
+
34
+ 1. **๐Ÿ–ผ๏ธ Upload an Image**: Start by uploading an image featuring a celebrity.
35
+ 2. **๐Ÿ” Check Your Guess**: The app will let you know if the celebrity in your image matches the target.
36
+ 3. **๐Ÿ† Win or Try Again**: Guess correctly to see a celebratory meme! If not, upload another image and try again.
37
+ 4. **๐Ÿ”„ Reset the Game**: Click 'Reset' to get a new target celebrity and start fresh.
38
+
39
+ This mode is perfect for testing your celebrity spotting skills and having a blast!
40
+
41
+ *Note:* ๐Ÿ”„ *If you encounter an error, please refresh the page.*
42
+ """
43
+
44
+ upload_mode_intro = """
45
+ ## ๐Ÿ“ค Upload Mode: Who's in the Picture?
46
+
47
+ **Story**: ๐Ÿ“ธ You've stumbled upon a photo filled with celebrities, but can't quite remember all their names. Don't stressโ€”our Upload Mode has got you covered! Simply upload the image, and we'll identify the stars for you in seconds.
48
+
49
+ **How to Use**:
50
+
51
+ 1. **๐Ÿ–ผ๏ธ Upload an Image**: Choose a photo that contains one or more celebrities.
52
+ 2. **๐Ÿง  View Detected Celebrities**: The app will scan the image and list all detected celebrities.
53
+ 3. **โ˜‘๏ธ Select a Celebrity**: Use the radio button to select the name of a celebrity from the list.
54
+ 4. **โ„น๏ธ See Details**: Once selected, the app displays details and a fun meme related to the celebrity.
55
+
56
+ This mode is perfect for quickly recognizing multiple celebrities and learning more about them!
57
+
58
+ *Note:* ๐Ÿ”„ *If you encounter an error, please refresh the page.*
59
+ """
60
+
61
+ # Combining the detailed intro, story, and interaction instructions into a single interface
62
+ with gr.Blocks() as main_interface:
63
+ gr.Markdown('# Welcome to the Celebrity Recognition Application ๐Ÿ˜ถโ€๐ŸŒซ๏ธ!')
64
+ with gr.Tabs():
65
+ with gr.TabItem("Intro"):
66
+ gr.Markdown(intro)
67
+
68
+ with gr.TabItem("Game Mode"):
69
+ gr.Markdown(game_mode_intro)
70
+ game_block.render()
71
+
72
+ with gr.TabItem("Upload Mode"):
73
+ gr.Markdown(upload_mode_intro)
74
+ upload_interface.render()
75
+
76
+ main_interface.launch(share=True)