aspectlens-demo / app.py
DukeShadow's picture
Create app.py
1e1e723 verified
raw
history blame contribute delete
624 Bytes
from huggingface_hub import snapshot_download
import sys
import gradio as gr
# Download the model repo
repo_path = snapshot_download(
repo_id="DukeShadow/AspectLens-Aspectwise-sentiment-breakdown",
repo_type="model"
)
# Make inference.py importable
sys.path.insert(0, repo_path)
from inference import predict
def analyze(text):
return predict(text)
gr.Interface(
fn=analyze,
inputs=gr.Textbox(lines=3, placeholder="Enter a product review"),
outputs="json",
title="AspectLens – Aspect-Based Sentiment Analysis",
description="Aspect-wise sentiment analysis for product reviews"
).launch()