Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -233,7 +233,7 @@ Feel free to put many feed lines
|
|
233 |
return generated_text.strip()
|
234 |
|
235 |
|
236 |
-
|
237 |
|
238 |
def get_reviews(url):
|
239 |
df = pd.DataFrame({'Text': scrape_reviews(url)})
|
@@ -243,29 +243,17 @@ def get_reviews(url):
|
|
243 |
most_common_noun = get_most_common_noun(noun_ver_adj)
|
244 |
dic1 = get_topics_adjectives(most_common_noun, noun_ver_adj)
|
245 |
dic2 = get_ratings_dic(df)
|
246 |
-
|
247 |
-
|
248 |
-
#return dic2,generated_text
|
249 |
-
return dic2
|
250 |
|
251 |
-
# gr.Interface(fn = get_reviews, inputs = gr.Textbox(), outputs = gr.Textbox(), title = 'The Topic Magnet',
|
252 |
-
# description = 'Enter the url of your Amazon reviews to get real ratings and valuable insights').launch(share = True)
|
253 |
|
254 |
-
#print(get_reviews(url))
|
255 |
|
256 |
|
257 |
-
|
|
|
258 |
description='Enter the url of your Amazon reviews to get real ratings and valuable insights')
|
259 |
-
interface.launch()
|
260 |
-
|
261 |
-
|
262 |
|
263 |
-
#print(most_common_noun)
|
264 |
-
#print(get_insights(most_common_noun[0],noun_ver_adj))
|
265 |
|
266 |
-
#dfs_topics = get_both_df(reviews,most_common_noun)
|
267 |
-
#df_all_topic_pos = dfs_topics[0]
|
268 |
-
#df_all_topic_neg = dfs_topics[1]
|
269 |
-
#print(get_percentages_topic(most_common_noun[0],df_all_topic_pos,df_all_topic_neg))
|
270 |
-
#print(get_df_adjectives('positive',reviews,most_common_noun[0],noun_ver_adj))
|
271 |
|
|
|
233 |
return generated_text.strip()
|
234 |
|
235 |
|
236 |
+
|
237 |
|
238 |
def get_reviews(url):
|
239 |
df = pd.DataFrame({'Text': scrape_reviews(url)})
|
|
|
243 |
most_common_noun = get_most_common_noun(noun_ver_adj)
|
244 |
dic1 = get_topics_adjectives(most_common_noun, noun_ver_adj)
|
245 |
dic2 = get_ratings_dic(df)
|
246 |
+
generated_text = generate_feedback(dic1)
|
247 |
+
return dic2,generated_text
|
|
|
|
|
248 |
|
|
|
|
|
249 |
|
|
|
250 |
|
251 |
|
252 |
+
if __name__ == '__main__':
|
253 |
+
interface = gr.Interface(fn=get_reviews, inputs=gr.Textbox(), outputs=[gr.Textbox(label = 'Real ratings'),gr.Textbox(label = 'Actionable insights')], title='The Topic Magnet',
|
254 |
description='Enter the url of your Amazon reviews to get real ratings and valuable insights')
|
255 |
+
interface.launch()
|
256 |
+
|
|
|
257 |
|
|
|
|
|
258 |
|
|
|
|
|
|
|
|
|
|
|
259 |
|