karthiknitt
commited on
Commit
•
a42051a
1
Parent(s):
a311358
changes
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load a pre-trained text classification model from Hugging Face
|
5 |
-
classifier = pipeline("sentiment-analysis")
|
6 |
|
7 |
def classify_text(text):
|
8 |
# Classify the input text
|
@@ -12,8 +12,8 @@ def classify_text(text):
|
|
12 |
# Define the Gradio interface
|
13 |
iface = gr.Interface(
|
14 |
fn=classify_text,
|
15 |
-
inputs=gr.
|
16 |
-
outputs=
|
17 |
title="Text Classification",
|
18 |
description="Classify text into positive or negative sentiment using Hugging Face Transformers."
|
19 |
)
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load a pre-trained text classification model from Hugging Face
|
5 |
+
classifier = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
|
6 |
|
7 |
def classify_text(text):
|
8 |
# Classify the input text
|
|
|
12 |
# Define the Gradio interface
|
13 |
iface = gr.Interface(
|
14 |
fn=classify_text,
|
15 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
16 |
+
outputs=gr.Textbox(),
|
17 |
title="Text Classification",
|
18 |
description="Classify text into positive or negative sentiment using Hugging Face Transformers."
|
19 |
)
|