Spaces:
Sleeping
Sleeping
victor
commited on
Commit
Β·
425c345
1
Parent(s):
0b983db
new line
Browse files- app.py +5 -9
- output/config.json β config.json +0 -0
- output/model.safetensors β model.safetensors +0 -0
- output/special_tokens_map.json β special_tokens_map.json +0 -0
- output/tokenizer.json β tokenizer.json +0 -0
- output/tokenizer_config.json β tokenizer_config.json +0 -0
- output/vocab.txt β vocab.txt +0 -0
app.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
-
import
|
2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
# Load the tokenizer
|
8 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
9 |
|
10 |
-
# Load the model directly from the local path
|
11 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
12 |
|
13 |
# Define the inference function
|
14 |
def predict_sentiment(text):
|
@@ -19,7 +16,6 @@ def predict_sentiment(text):
|
|
19 |
return label_map[predicted_label]
|
20 |
|
21 |
# Gradio interface set-up
|
22 |
-
import gradio as gr
|
23 |
title = "Movie Review Sentiment Analysis"
|
24 |
description = ("Enter a movie review and find out whether it's Positive or Negative!")
|
25 |
review = gr.Textbox(lines=10, label="Enter your movie review here...")
|
|
|
1 |
+
import gradio as gr
|
2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
3 |
+
import torch
|
4 |
|
5 |
+
#load model
|
6 |
+
model = AutoModelForSequenceClassification.from_pretrained("./")
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained("./")
|
|
|
|
|
8 |
|
|
|
|
|
9 |
|
10 |
# Define the inference function
|
11 |
def predict_sentiment(text):
|
|
|
16 |
return label_map[predicted_label]
|
17 |
|
18 |
# Gradio interface set-up
|
|
|
19 |
title = "Movie Review Sentiment Analysis"
|
20 |
description = ("Enter a movie review and find out whether it's Positive or Negative!")
|
21 |
review = gr.Textbox(lines=10, label="Enter your movie review here...")
|
output/config.json β config.json
RENAMED
File without changes
|
output/model.safetensors β model.safetensors
RENAMED
File without changes
|
output/special_tokens_map.json β special_tokens_map.json
RENAMED
File without changes
|
output/tokenizer.json β tokenizer.json
RENAMED
File without changes
|
output/tokenizer_config.json β tokenizer_config.json
RENAMED
File without changes
|
output/vocab.txt β vocab.txt
RENAMED
File without changes
|