Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit 884fa77

Browse files
committed
feat: demo support
1 parent a2d9ed5 commit 884fa77

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: amazon-reviews-classification
3-
emoji: 🐠
4-
colorFrom: gray
3+
emoji: 🗣️
4+
colorFrom: yellow
55
colorTo: purple
66
sdk: gradio
77
sdk_version: 5.20.1
88
app_file: app.py
99
pinned: false
1010
license: mit
11-
short_description: Applying Reviews Classification using Logistic Regression
11+
short_description: Sentiment Analysis via Logistic Regression
1212
---
1313

1414
<div>

app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import gradio as gr
2+
import pickle
3+
4+
from sklearn.feature_extraction.text import CountVectorizer
5+
6+
model = pickle.load(open('model.pkl', 'rb'))
7+
8+
def perform(text):
9+
vectorizer = CountVectorizer()
10+
text_input = vectorizer.transform([text])
11+
score = model.predict(text_input)[0]
12+
13+
return score
14+
15+
demo = gr.Interface(fn=predict,
16+
inputs=[gr.Textbox(label="Message")],
17+
outputs=gr.Textbox(label="Score"))
18+
19+
demo.launch()
File renamed without changes.

0 commit comments

Comments
 (0)