Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,12 @@ import asyncio
|
|
15 |
|
16 |
os.environ["OPENAI_API_KEY"] = "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"
|
17 |
|
18 |
-
app = Flask(__name__)
|
19 |
|
20 |
nlp = spacy.load('spacy_model')
|
21 |
sentiment_pipeline = pipeline("sentiment-analysis", model='my_sentiment_model')
|
22 |
classifier = pipeline(task="zero-shot-classification", model="my_zero_shot")
|
23 |
|
24 |
-
|
25 |
custom_headers = {
|
26 |
# Eliminating non-english reviews
|
27 |
"Accept-language": "en;q=1.0",
|
@@ -233,7 +232,6 @@ Feel free to put many feed lines
|
|
233 |
"""
|
234 |
llm = OpenAI(temperature = temperature, max_tokens = 1000)
|
235 |
generated_text = llm(text)
|
236 |
-
#return generated_text.strip().replace('\n',' ')
|
237 |
return generated_text.strip()
|
238 |
|
239 |
|
@@ -256,11 +254,11 @@ def get_reviews(url):
|
|
256 |
|
257 |
#print(get_reviews(url))
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
#app.run(host = '0.0.0.0', debug = True, port = 5000)
|
265 |
|
266 |
|
|
|
15 |
|
16 |
os.environ["OPENAI_API_KEY"] = "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"
|
17 |
|
|
|
18 |
|
19 |
nlp = spacy.load('spacy_model')
|
20 |
sentiment_pipeline = pipeline("sentiment-analysis", model='my_sentiment_model')
|
21 |
classifier = pipeline(task="zero-shot-classification", model="my_zero_shot")
|
22 |
|
23 |
+
|
24 |
custom_headers = {
|
25 |
# Eliminating non-english reviews
|
26 |
"Accept-language": "en;q=1.0",
|
|
|
232 |
"""
|
233 |
llm = OpenAI(temperature = temperature, max_tokens = 1000)
|
234 |
generated_text = llm(text)
|
|
|
235 |
return generated_text.strip()
|
236 |
|
237 |
|
|
|
254 |
|
255 |
#print(get_reviews(url))
|
256 |
|
257 |
+
|
258 |
+
asyncio.set_event_loop(asyncio.new_event_loop())
|
259 |
+
interface = gr.Interface(fn=get_reviews, inputs=gr.Textbox(), outputs=[gr.Textbox(label = 'Real ratings'),gr.Textbox(label = 'Actionable insights')], title='The Topic Magnet',
|
260 |
+
description='Enter the url of your Amazon reviews to get real ratings and valuable insights')
|
261 |
+
interface.launch()
|
262 |
#app.run(host = '0.0.0.0', debug = True, port = 5000)
|
263 |
|
264 |
|