Spaces:
Runtime error
Runtime error
Upload 16 files
Browse files- .gitattributes +3 -0
- assets/FathersDay.csv +65 -0
- assets/TheComedyOfErrors.csv +160 -0
- images/comedy.jpg +0 -0
- images/father.jpg +0 -0
- images/meeting.png +3 -0
- images/merchant.png +3 -0
- images/merchant_2.png +3 -0
- main.py +56 -0
- pages/comedy_of_errors.py +74 -0
- pages/fathers_day.py +61 -0
- utils/__pycache__/audio.cpython-310.pyc +0 -0
- utils/__pycache__/preprocessing.cpython-310.pyc +0 -0
- utils/__pycache__/streamlit_utils.cpython-310.pyc +0 -0
- utils/audio.py +29 -0
- utils/preprocessing.py +11 -0
- utils/streamlit_utils.py +28 -0
.gitattributes
CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
images/meeting.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
images/merchant_2.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
images/merchant.png filter=lfs diff=lfs merge=lfs -text
|
assets/FathersDay.csv
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Character,Line,Emotion
|
2 |
+
NARRATOR,HARPER sits at a table alone in a room. She is nervous and sad. Her FATHER enters and she tries to put on a happy face. He sits across the table from her,0.0666666666666667
|
3 |
+
FATHER,"Hi, Harper. I’m really happy you came.",0.8
|
4 |
+
HARPER,Happy Father’s Day.,0.8
|
5 |
+
FATHER,"Thanks… wow, you’re growing fast. How long has it been since I last saw you?",0.06250000000000001
|
6 |
+
HARPER,It was Christmas.,0.0
|
7 |
+
FATHER,That’s right. Christmas. I lose track of time. Every day seems like another.,0.2857142857142857
|
8 |
+
HARPER,Did you get the pictures? The ones of the school play?,0.0
|
9 |
+
FATHER,I did. I loved your costume. Did you sing? You have a wonderful voice.,0.85
|
10 |
+
HARPER,I did.,0.0
|
11 |
+
FATHER,Sing for me.,0.0
|
12 |
+
HARPER,Now?,0.0
|
13 |
+
FATHER,Sure.,0.5
|
14 |
+
HARPER,I can’t. Not in front of all these strangers.,0.0
|
15 |
+
FATHER,But you sang in front of the whole school.,0.2
|
16 |
+
HARPER,It’s not the same.,0.0
|
17 |
+
FATHER,Come on.,0.0
|
18 |
+
HARPER,Maybe you can make it to the next play?,0.0
|
19 |
+
FATHER,I wish I could.,0.0
|
20 |
+
HARPER,Maybe… if things go well here… you won’t be here forever… will you?,0.0
|
21 |
+
FATHER,I want to come home. I really do. I’m trying my best. I have another hearing next month. My lawyer says I might have a chance.,0.39999999999999997
|
22 |
+
HARPER,"I hope so… we miss you, Daddy.",0.0
|
23 |
+
FATHER,How is your mother?,0.0
|
24 |
+
HARPER,She told me not to talk about her.,0.0
|
25 |
+
FATHER,She’s still mad at me?,-0.625
|
26 |
+
HARPER,You left us.,0.0
|
27 |
+
FATHER,It wasn’t my choice.,0.0
|
28 |
+
HARPER,"You didn’t have to do that job. That’s what made you end up here, isn’t it?",0.0
|
29 |
+
FATHER,I wanted to take care of you all. I wanted to help. I lost my job and I didn’t have any other options.,-0.125
|
30 |
+
HARPER,Mom is supporting us now.,0.25
|
31 |
+
FATHER,You have a good mother. I’m happy she’s taking care of you. I just wish I could have done as good of a job.,0.7333333333333334
|
32 |
+
HARPER,You tried. I know you tried.,0.0
|
33 |
+
FATHER,I’d do anything for you… But it wasn’t enough.,0.0
|
34 |
+
HARPER,Just having you home would be enough.,0.0
|
35 |
+
FATHER,If your mother will let me.,0.0
|
36 |
+
HARPER,"It’s been hard for her. I’ve never seen her so sad. She cries every night. She never does it in front of me. She waits until she thinks I’m asleep. She has this picture of us in her room and she looks at it and cries. I want to help her, but I don’t know how.",-0.39583333333333337
|
37 |
+
FATHER,You are the reason she keeps going. She’s doing everything for you. She’ll never give up on you.,0.0
|
38 |
+
HARPER,I’m worried she is giving up on you.,0.0
|
39 |
+
FATHER,I can see why.,0.0
|
40 |
+
HARPER,Why can’t she forgive you?,0.0
|
41 |
+
FATHER,I don’t blame her. I can’t even forgive myself.,0.0
|
42 |
+
HARPER,"I forgive you, Daddy. I will always forgive you.",0.0
|
43 |
+
FATHER,"You’re a good girl, Harper. I hope you’ll always have a forgiving heart. And that no one ever does anything to change that.",0.7
|
44 |
+
HARPER,"What happened to you, Daddy? What changed you?",0.0
|
45 |
+
FATHER,I don’t know if I ever had a good heart.,0.7
|
46 |
+
HARPER,You were good to me.,0.7
|
47 |
+
FATHER,"I wanted to be different for you. I wanted to be better. Being a father changed me, it made me try harder to be good. But I guess it was too late.",0.16
|
48 |
+
HARPER,It’s never too late.,-0.3
|
49 |
+
FATHER,"I want to believe that you’re right. I wish it was as easy to be good as it is to be bad. No matter how hard I try, something always happens… something deceives me, tricks me, tempts me… I’m so weak.",0.008730158730158727
|
50 |
+
HARPER,"Don’t be sad, Daddy. Let’s think of something good. Tell me something you want to do when you come home.",0.09999999999999998
|
51 |
+
FATHER,"I want to take you to that pizza place, with all those games, the one we went to for your birthday. With all the lights and music… you did that dancing game… and you looked so happy. Everyone watched you dance and cheered. That’s one of my best memories.",0.9
|
52 |
+
HARPER,I was very happy.,1.0
|
53 |
+
FATHER,And I want to see one of your school plays. I hope you get the lead in the next one. And I want to be in the front row.,0.0
|
54 |
+
HARPER,"I want that too, Daddy. Real bad.",-1.0
|
55 |
+
FATHER,I will do my best.,1.0
|
56 |
+
HARPER,Can I give you a hug?,0.0
|
57 |
+
FATHER,They won’t let us. It’s against the rules.,0.0
|
58 |
+
HARPER,I hate the rules.,-0.8
|
59 |
+
FATHER,Harper. Don’t hate the rules. Hating the rules is what got me in here. Love the rules and don’t be like me.,-0.15000000000000002
|
60 |
+
HARPER,"Okay, Daddy.",0.5
|
61 |
+
FATHER,Never do anything that keeps you from giving your child a hug. That’s the worst part of this for me. Being away from you and your mother. Please ask your mother to come see me. I miss her.,-1.0
|
62 |
+
HARPER,I will.,0.0
|
63 |
+
FATHER,"Goodbye, Harper.",0.0
|
64 |
+
HARPER,"Goodbye, Daddy.",0.0
|
65 |
+
NARRATOR,They stand and look like they want to hug. Lights go to black,-0.16666666666666666
|
assets/TheComedyOfErrors.csv
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Character,Line,Gender,Emotion
|
2 |
+
NARRATOR,"Egeon, a merchant from Syracusae, is arrested for having illegally entered Ephesus. He tells the story of how he lost his wife and an infant son; the remaining identical-twin son grew up and set out to find his lost brother; Egeon in turn journeyed in search of the son he had raised. His journey has brought him to Ephesus. Now Egeon is given until the end of the day to raise ransom money. If he fails, he will be executed.Enter Solinus the Duke of Ephesus, with Egeon the Merchant of Syracuse, Jailer, and other Attendants.",Male,Positive
|
3 |
+
EGEON,"Proceed, Solinus, to procure my fall, And by the doom of death end woes and all.",Female,Positive
|
4 |
+
DUKE,"Merchant of Syracusa, plead no more.",Female,Positive
|
5 |
+
DUKE,I am not partial to infringe our laws.,Female,Negative
|
6 |
+
DUKE,The enmity and discord which of late,Female,Positive
|
7 |
+
DUKE,Sprung from the rancorous outrage of your duke,Female,Negative
|
8 |
+
DUKE,"To merchants, our well-dealing countrymen,",Female,Negative
|
9 |
+
DUKE,"Who, wanting guilders to redeem their lives,",Female,Negative
|
10 |
+
DUKE,"Have sealed his rigorous statutes with their bloods,",Female,Negative
|
11 |
+
DUKE,Excludes all pity from our threat’ning looks.,Female,Neutral
|
12 |
+
DUKE,For since the mortal and intestine jars,Female,Negative
|
13 |
+
DUKE,"’Twixt thy seditious countrymen and us,",Female,Positive
|
14 |
+
DUKE,"It hath in solemn synods been decreed,",Female,Negative
|
15 |
+
DUKE,"Both by the Syracusians and ourselves,",Female,Negative
|
16 |
+
DUKE,To admit no traffic to our adverse towns.,Female,Neutral
|
17 |
+
DUKE,"Nay, more, if any born at Ephesus",Female,Negative
|
18 |
+
DUKE,Be seen at Syracusian marts and fairs;,Female,Positive
|
19 |
+
DUKE,"Again, if any Syracusian born",Female,Negative
|
20 |
+
DUKE,"Come to the bay of Ephesus, he dies,",Female,Positive
|
21 |
+
DUKE,"His goods confiscate to the Duke’s dispose,",Female,Positive
|
22 |
+
DUKE,Unless a thousand marks be levièd,Female,Positive
|
23 |
+
DUKE,To quit the penalty and to ransom him.,Female,Negative
|
24 |
+
DUKE,"Thy substance, valued at the highest rate,",Female,Positive
|
25 |
+
DUKE,Cannot amount unto a hundred marks;,Female,Negative
|
26 |
+
DUKE,Therefore by law thou art condemned to die.,Female,Positive
|
27 |
+
EGEON,"Yet this my comfort: when your words are done,",Female,Negative
|
28 |
+
EGEON,My woes end likewise with the evening sun.,Female,Negative
|
29 |
+
DUKE,"Well, Syracusian, say in brief the cause",Female,Negative
|
30 |
+
DUKE,Why thou departedst from thy native home,Female,Positive
|
31 |
+
DUKE,And for what cause thou cam’st to Ephesus.,Female,Neutral
|
32 |
+
EGEON,A heavier task could not have been imposed,Female,Negative
|
33 |
+
EGEON,Than I to speak my griefs unspeakable;,Female,Neutral
|
34 |
+
EGEON,"Yet, that the world may witness that my end",Female,Negative
|
35 |
+
EGEON,"Was wrought by nature, not by vile offense,",Female,Negative
|
36 |
+
EGEON,I’ll utter what my sorrow gives me leave.,Female,Negative
|
37 |
+
EGEON,"In Syracusa was I born, and wed",Female,Neutral
|
38 |
+
EGEON,"Unto a woman happy but for me,",Female,Negative
|
39 |
+
EGEON,"And by me, had not our hap been bad.",Female,Negative
|
40 |
+
EGEON,With her I lived in joy. Our wealth increased,Female,Positive
|
41 |
+
EGEON,By prosperous voyages I often made,Female,Negative
|
42 |
+
EGEON,"To Epidamium, till my factor’s death",Female,Positive
|
43 |
+
EGEON,And the great care of goods at random left,Female,Positive
|
44 |
+
EGEON,Drew me from kind embracements of my spouse;,Female,Neutral
|
45 |
+
EGEON,From whom my absence was not six months old,Female,Neutral
|
46 |
+
EGEON,Before herself—almost at fainting under,Female,Negative
|
47 |
+
EGEON,The pleasing punishment that women bear—,Female,Positive
|
48 |
+
EGEON,Had made provision for her following me,Female,Neutral
|
49 |
+
EGEON,And soon and safe arrivèd where I was.,Female,Negative
|
50 |
+
EGEON,There had she not been long but she became,Female,Neutral
|
51 |
+
EGEON,"A joyful mother of two goodly sons,",Female,Positive
|
52 |
+
EGEON,"And, which was strange, the one so like the other",Female,Positive
|
53 |
+
EGEON,As could not be distinguished but by names.,Female,Positive
|
54 |
+
EGEON,"That very hour, and in the selfsame inn,",Female,Positive
|
55 |
+
EGEON,A mean woman was deliverèd,Female,Neutral
|
56 |
+
EGEON,"Of such a burden, male twins, both alike.",Female,Positive
|
57 |
+
EGEON,"Those, for their parents were exceeding poor,",Female,Positive
|
58 |
+
EGEON,I bought and brought up to attend my sons.,Female,Negative
|
59 |
+
EGEON,"My wife, not meanly proud of two such boys,",Female,Negative
|
60 |
+
EGEON,Made daily motions for our home return.,Female,Neutral
|
61 |
+
EGEON,"Unwilling, I agreed. Alas, too soon",Female,Negative
|
62 |
+
EGEON,We came aboard.,Female,Negative
|
63 |
+
EGEON,A league from Epidamium had we sailed,Female,Positive
|
64 |
+
EGEON,Before the always-wind-obeying deep,Female,Positive
|
65 |
+
EGEON,Gave any tragic instance of our harm;,Female,Neutral
|
66 |
+
EGEON,"But longer did we not retain much hope,",Female,Neutral
|
67 |
+
EGEON,For what obscurèd light the heavens did grant,Female,Positive
|
68 |
+
EGEON,Did but convey unto our fearful minds,Female,Neutral
|
69 |
+
EGEON,"A doubtful warrant of immediate death,",Female,Neutral
|
70 |
+
EGEON,"Which though myself would gladly have embraced,",Female,Negative
|
71 |
+
EGEON,"Yet the incessant weepings of my wife,",Female,Negative
|
72 |
+
EGEON,"Weeping before for what she saw must come,",Female,Negative
|
73 |
+
EGEON,"And piteous plainings of the pretty babes,",Female,Neutral
|
74 |
+
EGEON,"That mourned for fashion, ignorant what to fear,",Female,Positive
|
75 |
+
EGEON,Forced me to seek delays for them and me.,Female,Positive
|
76 |
+
EGEON,"And this it was, for other means was none:",Female,Neutral
|
77 |
+
EGEON,The sailors sought for safety by our boat,Female,Positive
|
78 |
+
EGEON,"And left the ship, then sinking-ripe, to us.",Female,Negative
|
79 |
+
EGEON,"My wife, more careful for the latter-born,",Female,Negative
|
80 |
+
EGEON,"Had fastened him unto a small spare mast,",Female,Neutral
|
81 |
+
EGEON,Such as seafaring men provide for storms.,Female,Negative
|
82 |
+
EGEON,"To him one of the other twins was bound,",Female,Negative
|
83 |
+
EGEON,Whilst I had been like heedful of the other.,Female,Negative
|
84 |
+
EGEON,"The children thus disposed, my wife and I,",Female,Negative
|
85 |
+
EGEON,"Fixing our eyes on whom our care was fixed,",Female,Negative
|
86 |
+
EGEON,Fastened ourselves at either end the mast,Female,Positive
|
87 |
+
EGEON,"And, floating straight, obedient to the stream,",Female,Negative
|
88 |
+
EGEON,"Was carried towards Corinth, as we thought.",Female,Negative
|
89 |
+
EGEON,"At length the sun, gazing upon the earth,",Female,Negative
|
90 |
+
EGEON,"Dispersed those vapors that offended us,",Female,Positive
|
91 |
+
EGEON,And by the benefit of his wished light,Female,Negative
|
92 |
+
EGEON,"The seas waxed calm, and we discoverèd",Female,Positive
|
93 |
+
EGEON,"Two ships from far, making amain to us,",Female,Neutral
|
94 |
+
EGEON,"Of Corinth that, of Epidaurus this.",Female,Negative
|
95 |
+
EGEON,"But ere they came—O, let me say no more!",Female,Negative
|
96 |
+
EGEON,Gather the sequel by that went before.,Female,Positive
|
97 |
+
DUKE,"Nay, forward, old man. Do not break off so,",Female,Neutral
|
98 |
+
DUKE,For we may pity though not pardon thee.,Female,Neutral
|
99 |
+
EGEON,"O, had the gods done so, I had not now",Female,Positive
|
100 |
+
EGEON,Worthily termed them merciless to us.,Female,Neutral
|
101 |
+
EGEON,"For, ere the ships could meet by twice five leagues,",Female,Neutral
|
102 |
+
EGEON,"We were encountered by a mighty rock,",Female,Neutral
|
103 |
+
EGEON,"Which being violently borne upon,",Female,Neutral
|
104 |
+
EGEON,Our helpful ship was splitted in the midst;,Female,Neutral
|
105 |
+
EGEON,"So that, in this unjust divorce of us,",Female,Neutral
|
106 |
+
EGEON,Fortune had left to both of us alike,Female,Neutral
|
107 |
+
EGEON,"What to delight in, what to sorrow for.",Female,Neutral
|
108 |
+
EGEON,"Her part, poor soul, seeming as burdenèd",Female,Neutral
|
109 |
+
EGEON,"With lesser weight, but not with lesser woe,",Female,Positive
|
110 |
+
EGEON,"Was carried with more speed before the wind,",Female,Negative
|
111 |
+
EGEON,And in our sight they three were taken up,Female,Neutral
|
112 |
+
EGEON,"By fishermen of Corinth, as we thought.",Female,Positive
|
113 |
+
EGEON,"At length, another ship had seized on us",Female,Negative
|
114 |
+
EGEON,"And, knowing whom it was their hap to save,",Female,Positive
|
115 |
+
EGEON,"Gave healthful welcome to their shipwracked guests,",Female,Neutral
|
116 |
+
EGEON,And would have reft the fishers of their prey,Female,Positive
|
117 |
+
EGEON,Had not their bark been very slow of sail;,Female,Positive
|
118 |
+
EGEON,And therefore homeward did they bend their course.,Female,Negative
|
119 |
+
EGEON,"Thus have you heard me severed from my bliss,",Female,Negative
|
120 |
+
EGEON,That by misfortunes was my life prolonged,Female,Neutral
|
121 |
+
EGEON,To tell sad stories of my own mishaps.,Female,Neutral
|
122 |
+
DUKE,"And for the sake of them thou sorrowest for,",Female,Neutral
|
123 |
+
DUKE,Do me the favor to dilate at full,Female,Negative
|
124 |
+
DUKE,What have befall’n of them and thee till now.,Female,Positive
|
125 |
+
EGEON,"My youngest boy, and yet my eldest care,",Female,Neutral
|
126 |
+
EGEON,At eighteen years became inquisitive,Female,Neutral
|
127 |
+
EGEON,"After his brother, and importuned me",Female,Positive
|
128 |
+
EGEON,"That his attendant—so his case was like,",Female,Neutral
|
129 |
+
EGEON,"Reft of his brother, but retained his name—",Female,Negative
|
130 |
+
EGEON,"Might bear him company in the quest of him,",Female,Negative
|
131 |
+
EGEON,"Whom whilst I labored of a love to see,",Female,Positive
|
132 |
+
EGEON,I hazarded the loss of whom I loved.,Female,Negative
|
133 |
+
EGEON,"Five summers have I spent in farthest Greece,",Female,Neutral
|
134 |
+
EGEON,"Roaming clean through the bounds of Asia,",Female,Neutral
|
135 |
+
EGEON,"And, coasting homeward, came to Ephesus,",Female,Negative
|
136 |
+
EGEON,"Hopeless to find, yet loath to leave unsought",Female,Positive
|
137 |
+
EGEON,Or that or any place that harbors men.,Female,Negative
|
138 |
+
EGEON,But here must end the story of my life;,Female,Negative
|
139 |
+
EGEON,And happy were I in my timely death,Female,Negative
|
140 |
+
EGEON,Could all my travels warrant me they live.,Female,Neutral
|
141 |
+
DUKE,"Hapless Egeon, whom the fates have marked",Female,Positive
|
142 |
+
DUKE,"To bear the extremity of dire mishap,",Female,Neutral
|
143 |
+
DUKE,"Now, trust me, were it not against our laws,",Female,Neutral
|
144 |
+
DUKE,"Against my crown, my oath, my dignity,",Female,Positive
|
145 |
+
DUKE,"Which princes, would they, may not disannul,",Female,Neutral
|
146 |
+
DUKE,My soul should sue as advocate for thee.,Female,Positive
|
147 |
+
DUKE,"But though thou art adjudgèd to the death,",Female,Neutral
|
148 |
+
DUKE,And passèd sentence may not be recalled,Female,Negative
|
149 |
+
DUKE,"But to our honor’s great disparagement,",Female,Neutral
|
150 |
+
DUKE,Yet will I favor thee in what I can.,Female,Negative
|
151 |
+
DUKE,"Therefore, merchant, I’ll limit thee this day",Female,Neutral
|
152 |
+
DUKE,To seek thy life by beneficial help.,Female,Negative
|
153 |
+
DUKE,Try all the friends thou hast in Ephesus;,Female,Negative
|
154 |
+
DUKE,"Beg thou, or borrow, to make up the sum,",Female,Negative
|
155 |
+
DUKE,"And live. If no, then thou art doomed to die.—",Female,Neutral
|
156 |
+
DUKE,"Jailer, take him to thy custody.",Female,Negative
|
157 |
+
JAILER,"I will, my lord.",Female,Positive
|
158 |
+
EGEON,"Hopeless and helpless doth Egeon wend,",Female,Positive
|
159 |
+
EGEON,But to procrastinate his lifeless end.,Female,Neutral
|
160 |
+
NARRATOR,They exit.,Male,Negative
|
images/comedy.jpg
ADDED
images/father.jpg
ADDED
images/meeting.png
ADDED
Git LFS Details
|
images/merchant.png
ADDED
Git LFS Details
|
images/merchant_2.png
ADDED
Git LFS Details
|
main.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
from utils.streamlit_utils import *
|
4 |
+
|
5 |
+
button_style = """<style>
|
6 |
+
|
7 |
+
.stApp {
|
8 |
+
background-color: black;
|
9 |
+
}
|
10 |
+
|
11 |
+
.stButton > button {
|
12 |
+
color: white;
|
13 |
+
|
14 |
+
background: black;
|
15 |
+
border-color: black;
|
16 |
+
width: 200px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.stButton > button:hover {
|
20 |
+
color: red;
|
21 |
+
border-color: black;
|
22 |
+
}
|
23 |
+
|
24 |
+
.stButton > button:focus {
|
25 |
+
border-color: black;
|
26 |
+
background: black;
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
.stButton > button:focus:not(:active) {
|
31 |
+
background: black;
|
32 |
+
border-color: black;
|
33 |
+
}
|
34 |
+
|
35 |
+
</style>
|
36 |
+
|
37 |
+
"""
|
38 |
+
|
39 |
+
st.markdown(f"<h1 style='text-align: center; color: white; font-family: arial;'>Tech Poets Society</h1>", unsafe_allow_html=True)
|
40 |
+
st.markdown(button_style, unsafe_allow_html=True)
|
41 |
+
comedy_of_errors = Image.open('images/comedy.jpg')
|
42 |
+
|
43 |
+
st.image(comedy_of_errors)
|
44 |
+
|
45 |
+
c1,c2,c3,c4,c5, c6 = st.columns(6)
|
46 |
+
|
47 |
+
if c3.button("The Comedy of Errors"):
|
48 |
+
nav_page("comedy_of_errors")
|
49 |
+
|
50 |
+
|
51 |
+
image = Image.open('images/father.jpg')
|
52 |
+
st.image(image)
|
53 |
+
|
54 |
+
d1, d2, d3, d4, d5, d6 = st.columns(6)
|
55 |
+
if d3.button("Father's Day"):
|
56 |
+
nav_page("fathers_day")
|
pages/comedy_of_errors.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
import requests
|
4 |
+
from PIL import Image
|
5 |
+
from utils.audio import *
|
6 |
+
from utils.preprocessing import *
|
7 |
+
|
8 |
+
play, names = preprocess_play("assets/TheComedyOfErrors.csv")
|
9 |
+
hide_streamlit_style = """
|
10 |
+
<style>
|
11 |
+
#MainMenu {visibility: hidden;}
|
12 |
+
footer {visibility: hidden;}
|
13 |
+
</style>
|
14 |
+
"""
|
15 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
16 |
+
colors = ['violet', 'green', 'blue', 'red', 'orange']
|
17 |
+
name_to_color = {}
|
18 |
+
i = 0
|
19 |
+
for name in names:
|
20 |
+
name_to_color[name] = colors[i]
|
21 |
+
i += 1
|
22 |
+
|
23 |
+
play_title = "The Comedy of Errors"
|
24 |
+
play_author = "William Shakespeare"
|
25 |
+
|
26 |
+
st.markdown(f"<h1 style='text-align: center; color: white;'>{play_title}</h1>", unsafe_allow_html=True)
|
27 |
+
st.markdown(f"<h5 style='text-align: center; color: white;'>{play_author}</h5>", unsafe_allow_html=True)
|
28 |
+
|
29 |
+
initial_img = Image.open('images/meeting.png')
|
30 |
+
ai_image = st.image(initial_img)
|
31 |
+
|
32 |
+
character_1 = st.markdown('')
|
33 |
+
quote_1 = st.markdown('')
|
34 |
+
character_2 = st.markdown('')
|
35 |
+
quote_2 = st.markdown('')
|
36 |
+
character_3 = st.markdown('')
|
37 |
+
quote_3 = st.markdown('')
|
38 |
+
|
39 |
+
url = 'http://127.0.0.1:5000/getDialog'
|
40 |
+
|
41 |
+
dialogues = [[character_1, quote_1], [character_2, quote_2], [character_3, quote_3]]
|
42 |
+
|
43 |
+
time.sleep(1)
|
44 |
+
counter = 0
|
45 |
+
prev_speaker = None
|
46 |
+
testing = Image.open('images/meeting.png')
|
47 |
+
for i in range(1, len(play)):
|
48 |
+
ai_image.image(testing)
|
49 |
+
rem = (i-1) % 3
|
50 |
+
speaker, speech = play[i]
|
51 |
+
sameSpeaker = speaker == prev_speaker
|
52 |
+
curr_color = name_to_color[speaker]
|
53 |
+
if not sameSpeaker:
|
54 |
+
dialogues[rem][0].markdown(':' + curr_color + '[' + speaker +']')
|
55 |
+
time.sleep(1)
|
56 |
+
|
57 |
+
dataToSend = {
|
58 |
+
"play_name": play_title,
|
59 |
+
"line_no": counter
|
60 |
+
}
|
61 |
+
|
62 |
+
audio = requests.post(url, data = dataToSend)
|
63 |
+
counter += 1
|
64 |
+
|
65 |
+
# time.sleep(1)
|
66 |
+
dialogues[rem][1].markdown(speech)
|
67 |
+
autoplay_audio(audio.content)
|
68 |
+
time.sleep(get_audio_duration(audio.content))
|
69 |
+
prev_speaker = speaker
|
70 |
+
if rem == 2:
|
71 |
+
for dialog in dialogues:
|
72 |
+
dialog[0].markdown('')
|
73 |
+
dialog[1].markdown('')
|
74 |
+
|
pages/fathers_day.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
import requests
|
4 |
+
from utils.audio import *
|
5 |
+
from utils.preprocessing import *
|
6 |
+
from PIL import Image
|
7 |
+
|
8 |
+
play, names = preprocess_play("assets/FathersDay.csv")
|
9 |
+
|
10 |
+
colors = ['violet', 'orange', 'blue', 'red', 'green']
|
11 |
+
name_to_color = {}
|
12 |
+
i = 0
|
13 |
+
for name in names:
|
14 |
+
name_to_color[name] = colors[i]
|
15 |
+
i += 1
|
16 |
+
|
17 |
+
play_title = "Father's Day"
|
18 |
+
play_author = "D. M. Larson"
|
19 |
+
st.markdown(f"<h1 style='text-align: center; color: white;'>{play_title}</h1>", unsafe_allow_html=True)
|
20 |
+
st.markdown(f"<h5 style='text-align: center; color: white;'>{play_author}</h5>", unsafe_allow_html=True)
|
21 |
+
|
22 |
+
|
23 |
+
initial_img = Image.open('images/meeting.png')
|
24 |
+
ai_img = st.image(initial_img)
|
25 |
+
|
26 |
+
character_1 = st.markdown('')
|
27 |
+
quote_1 = st.markdown('')
|
28 |
+
character_2 = st.markdown('')
|
29 |
+
quote_2 = st.markdown('')
|
30 |
+
character_3 = st.markdown('')
|
31 |
+
quote_3 = st.markdown('')
|
32 |
+
|
33 |
+
url = 'http://127.0.0.1:5000/getDialog'
|
34 |
+
|
35 |
+
dialogues = [[character_1, quote_1], [character_2, quote_2], [character_3, quote_3]]
|
36 |
+
|
37 |
+
time.sleep(1)
|
38 |
+
counter = 0
|
39 |
+
for i in range(1, len(play)):
|
40 |
+
rem = (i-1) % 3
|
41 |
+
item = play[i]
|
42 |
+
curr_color = name_to_color[item[0]]
|
43 |
+
time.sleep(1)
|
44 |
+
dialogues[rem][0].markdown(':' + curr_color + '[' + item[0] +']')
|
45 |
+
|
46 |
+
dataToSend = {
|
47 |
+
"play_name": play_title,
|
48 |
+
"line_no": counter
|
49 |
+
}
|
50 |
+
|
51 |
+
audio = requests.post(url, data = dataToSend)
|
52 |
+
counter += 1
|
53 |
+
time.sleep(1)
|
54 |
+
dialogues[rem][1].markdown(item[1])
|
55 |
+
autoplay_audio(audio.content)
|
56 |
+
time.sleep(get_audio_duration(audio.content))
|
57 |
+
|
58 |
+
if rem == 2:
|
59 |
+
for dialog in dialogues:
|
60 |
+
dialog[0].markdown('')
|
61 |
+
dialog[1].markdown('')
|
utils/__pycache__/audio.cpython-310.pyc
ADDED
Binary file (1.02 kB). View file
|
|
utils/__pycache__/preprocessing.cpython-310.pyc
ADDED
Binary file (540 Bytes). View file
|
|
utils/__pycache__/streamlit_utils.cpython-310.pyc
ADDED
Binary file (1.42 kB). View file
|
|
utils/audio.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
+
from io import BytesIO
|
3 |
+
import librosa
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
|
7 |
+
def get_audio_duration(audio_bytes, sr=22050):
|
8 |
+
try:
|
9 |
+
# Convert bytes to numpy array
|
10 |
+
audio_array, _ = librosa.load(BytesIO(audio_bytes), sr=sr)
|
11 |
+
|
12 |
+
# Calculate the duration in seconds
|
13 |
+
duration_in_seconds = len(audio_array) / float(sr)
|
14 |
+
|
15 |
+
return duration_in_seconds
|
16 |
+
except Exception as e:
|
17 |
+
print(f"Error processing audio: {e}")
|
18 |
+
return None
|
19 |
+
|
20 |
+
def autoplay_audio(data: any):
|
21 |
+
b64 = base64.b64encode(data).decode()
|
22 |
+
md = f"""
|
23 |
+
<audio autoplay="true">
|
24 |
+
<source src="data:audio/mp3;base64,{b64}" type="audio/mp3">
|
25 |
+
</audio>
|
26 |
+
"""
|
27 |
+
st.markdown(
|
28 |
+
md,
|
29 |
+
unsafe_allow_html=True, )
|
utils/preprocessing.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
|
3 |
+
def preprocess_play(filepath):
|
4 |
+
out_str = []
|
5 |
+
unique_names = set()
|
6 |
+
with open(filepath) as f:
|
7 |
+
reader = csv.reader(f, delimiter=',')
|
8 |
+
for row in reader:
|
9 |
+
unique_names.add(row[0])
|
10 |
+
out_str.append([row[0], row[1]])
|
11 |
+
return (out_str, unique_names)
|
utils/streamlit_utils.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit.components.v1 import html
|
3 |
+
|
4 |
+
def nav_page(page_name, timeout_secs=3):
|
5 |
+
nav_script = """
|
6 |
+
<script type="text/javascript">
|
7 |
+
function attempt_nav_page(page_name, start_time, timeout_secs) {
|
8 |
+
var links = window.parent.document.getElementsByTagName("a");
|
9 |
+
for (var i = 0; i < links.length; i++) {
|
10 |
+
if (links[i].href.toLowerCase().endsWith("/" + page_name.toLowerCase())) {
|
11 |
+
links[i].click();
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
}
|
15 |
+
var elasped = new Date() - start_time;
|
16 |
+
if (elasped < timeout_secs * 1000) {
|
17 |
+
setTimeout(attempt_nav_page, 100, page_name, start_time, timeout_secs);
|
18 |
+
} else {
|
19 |
+
alert("Unable to navigate to page '" + page_name + "' after " + timeout_secs + " second(s).");
|
20 |
+
}
|
21 |
+
}
|
22 |
+
window.addEventListener("load", function() {
|
23 |
+
attempt_nav_page("%s", new Date(), %d);
|
24 |
+
});
|
25 |
+
</script>
|
26 |
+
""" % (page_name, timeout_secs)
|
27 |
+
|
28 |
+
html(nav_script)
|