Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1960,7 +1960,6 @@ This report assessed the quality of {data.get('summary', {}).get('total_reviews'
|
|
| 1960 |
logger.error(f"Report generation error: {str(e)}")
|
| 1961 |
return f"Report generation failed: {str(e)}"
|
| 1962 |
|
| 1963 |
-
# Create Gradio interface
|
| 1964 |
def create_gradio_interface():
|
| 1965 |
"""Create Gradio interface"""
|
| 1966 |
|
|
@@ -2036,6 +2035,19 @@ def create_gradio_interface():
|
|
| 2036 |
placeholder="Enter review text...",
|
| 2037 |
label="Review Text"
|
| 2038 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2039 |
emotion_file = gr.File(
|
| 2040 |
label="Upload File",
|
| 2041 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2062,6 +2074,19 @@ def create_gradio_interface():
|
|
| 2062 |
placeholder="Enter review text...",
|
| 2063 |
label="Review Text"
|
| 2064 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2065 |
aspect_file = gr.File(
|
| 2066 |
label="Upload File",
|
| 2067 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2088,6 +2113,19 @@ def create_gradio_interface():
|
|
| 2088 |
placeholder="Enter reviews to be detected...",
|
| 2089 |
label="Review Text"
|
| 2090 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2091 |
fake_file = gr.File(
|
| 2092 |
label="Upload File (supports metadata analysis like usernames, timestamps)",
|
| 2093 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2114,6 +2152,19 @@ def create_gradio_interface():
|
|
| 2114 |
placeholder="Enter review text...",
|
| 2115 |
label="Review Text"
|
| 2116 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2117 |
quality_file = gr.File(
|
| 2118 |
label="Upload File",
|
| 2119 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2154,6 +2205,19 @@ def create_gradio_interface():
|
|
| 2154 |
placeholder="Enter review text...",
|
| 2155 |
label="Review Text"
|
| 2156 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2157 |
rec_file = gr.File(
|
| 2158 |
label="Upload File",
|
| 2159 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2203,6 +2267,19 @@ def create_gradio_interface():
|
|
| 2203 |
placeholder="Product A reviews...",
|
| 2204 |
label="Product A Reviews"
|
| 2205 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2206 |
comp_file_a = gr.File(
|
| 2207 |
label="Upload Product A File",
|
| 2208 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2215,6 +2292,19 @@ def create_gradio_interface():
|
|
| 2215 |
placeholder="Product B reviews...",
|
| 2216 |
label="Product B Reviews"
|
| 2217 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2218 |
comp_file_b = gr.File(
|
| 2219 |
label="Upload Product B File",
|
| 2220 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
@@ -2280,7 +2370,7 @@ def create_gradio_interface():
|
|
| 2280 |
outputs=[report_output]
|
| 2281 |
)
|
| 2282 |
|
| 2283 |
-
with gr.Tab("
|
| 2284 |
gr.Markdown("""
|
| 2285 |
## π SmartReview Pro User Guide
|
| 2286 |
|
|
|
|
| 1960 |
logger.error(f"Report generation error: {str(e)}")
|
| 1961 |
return f"Report generation failed: {str(e)}"
|
| 1962 |
|
|
|
|
| 1963 |
def create_gradio_interface():
|
| 1964 |
"""Create Gradio interface"""
|
| 1965 |
|
|
|
|
| 2035 |
placeholder="Enter review text...",
|
| 2036 |
label="Review Text"
|
| 2037 |
)
|
| 2038 |
+
|
| 2039 |
+
# Sample reviews
|
| 2040 |
+
gr.Markdown("**Sample Reviews:**")
|
| 2041 |
+
|
| 2042 |
+
emotion_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2043 |
+
emotion_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=emotion_text)
|
| 2044 |
+
|
| 2045 |
+
emotion_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2046 |
+
emotion_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=emotion_text)
|
| 2047 |
+
|
| 2048 |
+
emotion_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2049 |
+
emotion_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=emotion_text)
|
| 2050 |
+
|
| 2051 |
emotion_file = gr.File(
|
| 2052 |
label="Upload File",
|
| 2053 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2074 |
placeholder="Enter review text...",
|
| 2075 |
label="Review Text"
|
| 2076 |
)
|
| 2077 |
+
|
| 2078 |
+
# Sample reviews
|
| 2079 |
+
gr.Markdown("**Sample Reviews:**")
|
| 2080 |
+
|
| 2081 |
+
aspect_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2082 |
+
aspect_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=aspect_text)
|
| 2083 |
+
|
| 2084 |
+
aspect_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2085 |
+
aspect_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=aspect_text)
|
| 2086 |
+
|
| 2087 |
+
aspect_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2088 |
+
aspect_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=aspect_text)
|
| 2089 |
+
|
| 2090 |
aspect_file = gr.File(
|
| 2091 |
label="Upload File",
|
| 2092 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2113 |
placeholder="Enter reviews to be detected...",
|
| 2114 |
label="Review Text"
|
| 2115 |
)
|
| 2116 |
+
|
| 2117 |
+
# Sample reviews
|
| 2118 |
+
gr.Markdown("**Sample Reviews:**")
|
| 2119 |
+
|
| 2120 |
+
fake_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2121 |
+
fake_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=fake_text)
|
| 2122 |
+
|
| 2123 |
+
fake_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2124 |
+
fake_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=fake_text)
|
| 2125 |
+
|
| 2126 |
+
fake_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2127 |
+
fake_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=fake_text)
|
| 2128 |
+
|
| 2129 |
fake_file = gr.File(
|
| 2130 |
label="Upload File (supports metadata analysis like usernames, timestamps)",
|
| 2131 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2152 |
placeholder="Enter review text...",
|
| 2153 |
label="Review Text"
|
| 2154 |
)
|
| 2155 |
+
|
| 2156 |
+
# Sample reviews
|
| 2157 |
+
gr.Markdown("**Sample Reviews:**")
|
| 2158 |
+
|
| 2159 |
+
quality_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2160 |
+
quality_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=quality_text)
|
| 2161 |
+
|
| 2162 |
+
quality_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2163 |
+
quality_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=quality_text)
|
| 2164 |
+
|
| 2165 |
+
quality_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2166 |
+
quality_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=quality_text)
|
| 2167 |
+
|
| 2168 |
quality_file = gr.File(
|
| 2169 |
label="Upload File",
|
| 2170 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2205 |
placeholder="Enter review text...",
|
| 2206 |
label="Review Text"
|
| 2207 |
)
|
| 2208 |
+
|
| 2209 |
+
# Sample reviews
|
| 2210 |
+
gr.Markdown("**Sample Reviews:**")
|
| 2211 |
+
|
| 2212 |
+
rec_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2213 |
+
rec_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=rec_text)
|
| 2214 |
+
|
| 2215 |
+
rec_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2216 |
+
rec_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=rec_text)
|
| 2217 |
+
|
| 2218 |
+
rec_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2219 |
+
rec_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=rec_text)
|
| 2220 |
+
|
| 2221 |
rec_file = gr.File(
|
| 2222 |
label="Upload File",
|
| 2223 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2267 |
placeholder="Product A reviews...",
|
| 2268 |
label="Product A Reviews"
|
| 2269 |
)
|
| 2270 |
+
|
| 2271 |
+
# Sample reviews for Product A
|
| 2272 |
+
gr.Markdown("**Sample Reviews for Product A:**")
|
| 2273 |
+
|
| 2274 |
+
comp_a_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2275 |
+
comp_a_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=comp_text_a)
|
| 2276 |
+
|
| 2277 |
+
comp_a_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2278 |
+
comp_a_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=comp_text_a)
|
| 2279 |
+
|
| 2280 |
+
comp_a_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2281 |
+
comp_a_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=comp_text_a)
|
| 2282 |
+
|
| 2283 |
comp_file_a = gr.File(
|
| 2284 |
label="Upload Product A File",
|
| 2285 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2292 |
placeholder="Product B reviews...",
|
| 2293 |
label="Product B Reviews"
|
| 2294 |
)
|
| 2295 |
+
|
| 2296 |
+
# Sample reviews for Product B
|
| 2297 |
+
gr.Markdown("**Sample Reviews for Product B:**")
|
| 2298 |
+
|
| 2299 |
+
comp_b_positive_btn = gr.Button("Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", size="sm")
|
| 2300 |
+
comp_b_positive_btn.click(lambda: "Amazing product! Sound quality is excellent, battery lasts all day. Easy setup and great build quality. Highly recommend for anyone looking for reliable wireless speaker. Worth the money!", outputs=comp_text_b)
|
| 2301 |
+
|
| 2302 |
+
comp_b_negative_btn = gr.Button("Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", size="sm")
|
| 2303 |
+
comp_b_negative_btn.click(lambda: "Terrible purchase. Product broke after two days, looks nothing like photos. Poor quality materials and unhelpful customer service. Complete waste of money, do not buy!", outputs=comp_text_b)
|
| 2304 |
+
|
| 2305 |
+
comp_b_mixed_btn = gr.Button("Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", size="sm")
|
| 2306 |
+
comp_b_mixed_btn.click(lambda: "Coffee maker works okay. Good temperature control but small water reservoir. Some parts feel cheap. Decent for the price but not exceptional quality.", outputs=comp_text_b)
|
| 2307 |
+
|
| 2308 |
comp_file_b = gr.File(
|
| 2309 |
label="Upload Product B File",
|
| 2310 |
file_types=[".csv", ".xlsx", ".xls"]
|
|
|
|
| 2370 |
outputs=[report_output]
|
| 2371 |
)
|
| 2372 |
|
| 2373 |
+
with gr.Tab("π User Guide"):
|
| 2374 |
gr.Markdown("""
|
| 2375 |
## π SmartReview Pro User Guide
|
| 2376 |
|