Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -237,13 +237,21 @@ Feel free to put many feed lines
|
|
237 |
|
238 |
def get_reviews(url):
|
239 |
df = pd.DataFrame({'Text': scrape_reviews(url)})
|
|
|
240 |
df = preprocess_data(df)
|
|
|
241 |
reviews = df.Text
|
|
|
242 |
noun_ver_adj = get_noun_ver_adj(reviews)
|
|
|
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 |
|
@@ -252,6 +260,7 @@ def get_reviews(url):
|
|
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.queue().launch()
|
256 |
|
257 |
|
|
|
237 |
|
238 |
def get_reviews(url):
|
239 |
df = pd.DataFrame({'Text': scrape_reviews(url)})
|
240 |
+
print('ok 1')
|
241 |
df = preprocess_data(df)
|
242 |
+
print('ok 2')
|
243 |
reviews = df.Text
|
244 |
+
print('ok 3')
|
245 |
noun_ver_adj = get_noun_ver_adj(reviews)
|
246 |
+
print('ok 4')
|
247 |
most_common_noun = get_most_common_noun(noun_ver_adj)
|
248 |
+
print('ok 5')
|
249 |
dic1 = get_topics_adjectives(most_common_noun, noun_ver_adj)
|
250 |
+
print('ok 6')
|
251 |
dic2 = get_ratings_dic(df)
|
252 |
+
print('ok 7')
|
253 |
generated_text = generate_feedback(dic1)
|
254 |
+
print('ok 8')
|
255 |
return dic2,generated_text
|
256 |
|
257 |
|
|
|
260 |
if __name__ == '__main__':
|
261 |
interface = gr.Interface(fn=get_reviews, inputs=gr.Textbox(), outputs=[gr.Textbox(label = 'Real ratings'),gr.Textbox(label = 'Actionable insights')], title='The Topic Magnet',
|
262 |
description='Enter the url of your Amazon reviews to get real ratings and valuable insights')
|
263 |
+
print('ok 9')
|
264 |
interface.queue().launch()
|
265 |
|
266 |
|