DukeShadow commited on
Commit
1e1e723
·
verified ·
1 Parent(s): c8a23db

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import snapshot_download
2
+ import sys
3
+ import gradio as gr
4
+
5
+ # Download the model repo
6
+ repo_path = snapshot_download(
7
+ repo_id="DukeShadow/AspectLens-Aspectwise-sentiment-breakdown",
8
+ repo_type="model"
9
+ )
10
+
11
+ # Make inference.py importable
12
+ sys.path.insert(0, repo_path)
13
+ from inference import predict
14
+
15
+ def analyze(text):
16
+ return predict(text)
17
+
18
+ gr.Interface(
19
+ fn=analyze,
20
+ inputs=gr.Textbox(lines=3, placeholder="Enter a product review"),
21
+ outputs="json",
22
+ title="AspectLens – Aspect-Based Sentiment Analysis",
23
+ description="Aspect-wise sentiment analysis for product reviews"
24
+ ).launch()