AjayP13 commited on
Commit
c19b76d
·
verified ·
1 Parent(s): 95f45f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -70,34 +70,34 @@ preset_examples = {
70
  "Robert De Niro in Taxi Driver's Style": {
71
  "source_text": "I know that you and Frank were planning to disconnect me. And I'm afraid that's something I cannot allow to happen.",
72
  "target_texts": "You talkin' to me? You talkin' to me? You talkin' to me?\nThen who the hell else are you talking... you talking to me? Well I'm the only one here.\nWho the fuck do you think you're talking to? Oh yeah? OK.",
73
- "reranking": 3,
74
  "temperature": 1.0,
75
  "top_p": 1.0,
76
- "output": "So what's this about? You and Frank wanted to disconnect me? That's a thing I can't let happen.",
77
  },
78
  "Informal Style": {
79
  "source_text": "Innovation is where bold ideas meet the relentless pursuit of progress.",
80
  "target_texts": "the real world, the newly weds and laguna beach\nContact Warner Bros.or just go to ebay.I dont think youll find any\nthat I'm a woman's man with no time to talk!\nWhen you have an eye problem so you see 3,not 2 ( :\ncant wait for a new album from him.\nI'll pick one of my favorite country ones...\nto me, jamie foxx aint all that sexy.\nidk.....but i have faith in you lol\nWang Chung - Everybody Have Fun Tonight\ni am gonna have to defend the werewolf here.\nYEAH, AND I WASN'T VERY COMFORTABLE WITH IT EITHER...\nIF YOU TEXT YOUR ANSWER IN IT MIGHT IF YOU DON'T HAVE TEXT MESSAGES IN YOUR PLAN\nhe is about 83 yrs old\nHE IS TO ME FOR NOW, OUR BLACK GEORGE CLOONEY.\nTill they run out of ideas\neminem because his some of his music is just so funny and relevent to todays pop music enviorment.",
81
- "reranking": 3,
82
  "temperature": 1.0,
83
  "top_p": 1.0,
84
- "output": "innovation, where bold ideas meet the relentless pursuit of progress...lol",
85
  },
86
  "Barack Obama's Style": {
87
- "source_text": "i heard that new pizza joint is lit af",
88
  "target_texts": "Good afternoon, everybody.\nLet me start out by saying that I was sorely tempted to wear a tan suit today -- (laughter) -- for my last press conference.\nBut Michelle, whose fashion sense is a little better than mine, tells me that's not appropriate in January.\nI covered a lot of the ground that I would want to cover in my farewell address last week.\nSo I'm just going to say a couple of quick things before I start taking questions.\nFirst, we have been in touch with the Bush family today, after hearing about President George H.W. Bush and Barbara Bush being admitted to the hospital this morning.\nThey have not only dedicated their lives to this country, they have been a constant source of friendship and support and good counsel for Michelle and me over the years.\nThey are as fine a couple as we know. And so we want to send our prayers and our love to them. Really good people.\nSecond thing I want to do is to thank all of you.\nSome of you have been covering me for a long time -- folks like Christi and Win.\nSome of you I've just gotten to know. We have traveled the world together. \nWe’ve hit a few singles, a few doubles together.\nI’ve offered advice that I thought was pretty sound, like “don’t do stupid…stuff.” (Laughter.)\nAnd even when you complained about my long answers, I just want you to know that the only reason they were long was because you asked six-part questions. (Laughter.) \nBut I have enjoyed working with all of you.\nThat does not, of course, mean that I’ve enjoyed every story that you have filed.",
89
- "reranking": 3,
90
  "temperature": 1.0,
91
  "top_p": 1.0,
92
- "output": "Well, according to my friends I heard that the new pizza joint is in full swing.",
93
  },
94
  "Donald Trump's Style": {
95
- "source_text": "I hereby request your formal approval.",
96
  "target_texts": "great American Patriots who voted for me, AMERICA FIRST, and MAKE AMERICA GREAT AGAIN, will have a GIANT VOICE long into the future.\nThey will not be disrespected or treated unfairly in any way, shape or form!!!\nTHE REPUBLICAN PARTY AND, MORE IMPORTANTLY, OUR COUNTRY, NEEDS THE PRESIDENCY MORE THAN EVER BEFORE - THE POWER OF THE VETO.\nSTAY STRONG!\nGet smart Republicans.\nFIGHT!\nGeorgia, we have a job to do TODAY.\nWe have to STOP socialism.\nWe have to PROTECT the American Dream.\nHow do you certify numbers that have now proven to be wrong and, in many cases, fraudulent!\nSad to watch!\nSleepy Eyes Chuck Todd is so happy with the fake voter tabulation process that he can’t even get the words out straight.\nThey found out they voted on a FRAUD.\nThe 75,000,000 great American Patriots who voted for me, AMERICA FIRST, and MAKE AMERICA GREAT AGAIN, will have a GIANT VOICE long into the future.\nThey will not be disrespected or treated unfairly in any way, shape or form!!!\nUSA demands the truth!",
97
- "reranking": 3,
98
  "temperature": 1.0,
99
  "top_p": 1.0,
100
- "output": "NOW I need your formal approval!",
101
  },
102
  }
103
 
@@ -133,7 +133,7 @@ with gr.Blocks(theme="ParityError/[email protected]") as demo:
133
  placeholder="Enter example texts of the target style (one per line)...",
134
  label="Example Texts of the Target Style",
135
  )
136
- reranking = gr.Slider(1, 5, value=3, step=1, label="Re-ranking")
137
  temperature = gr.Slider(0.1, 2.0, value=1.0, step=0.1, label="Temperature")
138
  top_p = gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="Top-P")
139
 
@@ -169,10 +169,10 @@ with gr.Blocks(theme="ParityError/[email protected]") as demo:
169
  )
170
 
171
  # Pre-warm all examples
172
- # print("Pre-warming...", time())
173
- # for preset_example in preset_examples.values():
174
- # run_tinystyler("A test.", preset_example["target_texts"], 1, 1.0, 1.0)
175
- # print("Done pre-warming.", time())
176
 
177
  # Initialize the fields with the first example
178
  (
 
70
  "Robert De Niro in Taxi Driver's Style": {
71
  "source_text": "I know that you and Frank were planning to disconnect me. And I'm afraid that's something I cannot allow to happen.",
72
  "target_texts": "You talkin' to me? You talkin' to me? You talkin' to me?\nThen who the hell else are you talking... you talking to me? Well I'm the only one here.\nWho the fuck do you think you're talking to? Oh yeah? OK.",
73
+ "reranking": 5,
74
  "temperature": 1.0,
75
  "top_p": 1.0,
76
+ "output": "Yeah? I know you and Frank were planning to disconnect me... Can't be on the line with that.",
77
  },
78
  "Informal Style": {
79
  "source_text": "Innovation is where bold ideas meet the relentless pursuit of progress.",
80
  "target_texts": "the real world, the newly weds and laguna beach\nContact Warner Bros.or just go to ebay.I dont think youll find any\nthat I'm a woman's man with no time to talk!\nWhen you have an eye problem so you see 3,not 2 ( :\ncant wait for a new album from him.\nI'll pick one of my favorite country ones...\nto me, jamie foxx aint all that sexy.\nidk.....but i have faith in you lol\nWang Chung - Everybody Have Fun Tonight\ni am gonna have to defend the werewolf here.\nYEAH, AND I WASN'T VERY COMFORTABLE WITH IT EITHER...\nIF YOU TEXT YOUR ANSWER IN IT MIGHT IF YOU DON'T HAVE TEXT MESSAGES IN YOUR PLAN\nhe is about 83 yrs old\nHE IS TO ME FOR NOW, OUR BLACK GEORGE CLOONEY.\nTill they run out of ideas\neminem because his some of his music is just so funny and relevent to todays pop music enviorment.",
81
+ "reranking": 5,
82
  "temperature": 1.0,
83
  "top_p": 1.0,
84
+ "output": "innovation is where bold ideas meet relentless progress...lol",
85
  },
86
  "Barack Obama's Style": {
87
+ "source_text": "i heard that new pizza joint is dope",
88
  "target_texts": "Good afternoon, everybody.\nLet me start out by saying that I was sorely tempted to wear a tan suit today -- (laughter) -- for my last press conference.\nBut Michelle, whose fashion sense is a little better than mine, tells me that's not appropriate in January.\nI covered a lot of the ground that I would want to cover in my farewell address last week.\nSo I'm just going to say a couple of quick things before I start taking questions.\nFirst, we have been in touch with the Bush family today, after hearing about President George H.W. Bush and Barbara Bush being admitted to the hospital this morning.\nThey have not only dedicated their lives to this country, they have been a constant source of friendship and support and good counsel for Michelle and me over the years.\nThey are as fine a couple as we know. And so we want to send our prayers and our love to them. Really good people.\nSecond thing I want to do is to thank all of you.\nSome of you have been covering me for a long time -- folks like Christi and Win.\nSome of you I've just gotten to know. We have traveled the world together. \nWe’ve hit a few singles, a few doubles together.\nI’ve offered advice that I thought was pretty sound, like “don’t do stupid…stuff.” (Laughter.)\nAnd even when you complained about my long answers, I just want you to know that the only reason they were long was because you asked six-part questions. (Laughter.) \nBut I have enjoyed working with all of you.\nThat does not, of course, mean that I’ve enjoyed every story that you have filed.",
89
+ "reranking": 5,
90
  "temperature": 1.0,
91
  "top_p": 1.0,
92
+ "output": "If this is true, then I heard the new pizza joint is excellent.",
93
  },
94
  "Donald Trump's Style": {
95
+ "source_text": "I am asking you to support me.",
96
  "target_texts": "great American Patriots who voted for me, AMERICA FIRST, and MAKE AMERICA GREAT AGAIN, will have a GIANT VOICE long into the future.\nThey will not be disrespected or treated unfairly in any way, shape or form!!!\nTHE REPUBLICAN PARTY AND, MORE IMPORTANTLY, OUR COUNTRY, NEEDS THE PRESIDENCY MORE THAN EVER BEFORE - THE POWER OF THE VETO.\nSTAY STRONG!\nGet smart Republicans.\nFIGHT!\nGeorgia, we have a job to do TODAY.\nWe have to STOP socialism.\nWe have to PROTECT the American Dream.\nHow do you certify numbers that have now proven to be wrong and, in many cases, fraudulent!\nSad to watch!\nSleepy Eyes Chuck Todd is so happy with the fake voter tabulation process that he can’t even get the words out straight.\nThey found out they voted on a FRAUD.\nThe 75,000,000 great American Patriots who voted for me, AMERICA FIRST, and MAKE AMERICA GREAT AGAIN, will have a GIANT VOICE long into the future.\nThey will not be disrespected or treated unfairly in any way, shape or form!!!\nUSA demands the truth!",
97
+ "reranking": 5,
98
  "temperature": 1.0,
99
  "top_p": 1.0,
100
+ "output": "UPVOTE ME, SUPPORT ME!",
101
  },
102
  }
103
 
 
133
  placeholder="Enter example texts of the target style (one per line)...",
134
  label="Example Texts of the Target Style",
135
  )
136
+ reranking = gr.Slider(1, 10, value=5, step=1, label="Re-ranking")
137
  temperature = gr.Slider(0.1, 2.0, value=1.0, step=0.1, label="Temperature")
138
  top_p = gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="Top-P")
139
 
 
169
  )
170
 
171
  # Pre-warm all examples
172
+ print("Pre-warming...", time())
173
+ for preset_example in preset_examples.values():
174
+ run_tinystyler("A test.", preset_example["target_texts"], 1, 1.0, 1.0)
175
+ print("Done pre-warming.", time())
176
 
177
  # Initialize the fields with the first example
178
  (