jarif commited on
Commit
9da0dc3
1 Parent(s): 81ac0f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -4,8 +4,8 @@ import tensorflow as tf
4
  from transformers import DistilBertTokenizer, TFDistilBertModel
5
  import pandas as pd
6
 
7
- # Load your data
8
- df = pd.read_csv("new_bangla.csv")
9
 
10
  # Extract text and label columns
11
  sentences = df["text"]
@@ -15,8 +15,11 @@ labels = df["label"]
15
  distil_bert_tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
16
  distil_bert_model = TFDistilBertModel.from_pretrained('distilbert-base-uncased')
17
 
18
- # Load the saved model
19
- model = tf.keras.models.load_model("bangla_fake.h5")
 
 
 
20
 
21
  # Define Gradio interface
22
  def classify_bangla_fake_news(description):
 
4
  from transformers import DistilBertTokenizer, TFDistilBertModel
5
  import pandas as pd
6
 
7
+ # Load your data from new_bangla.csv
8
+ df = pd.read_csv("new_bangla.csv") # Update the filename here
9
 
10
  # Extract text and label columns
11
  sentences = df["text"]
 
15
  distil_bert_tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
16
  distil_bert_model = TFDistilBertModel.from_pretrained('distilbert-base-uncased')
17
 
18
+ # Define custom objects for model loading
19
+ custom_objects = {'TFDistilBertModel': TFDistilBertModel}
20
+
21
+ # Load the saved model with custom objects
22
+ model = tf.keras.models.load_model("bangla_fake.h5", custom_objects=custom_objects)
23
 
24
  # Define Gradio interface
25
  def classify_bangla_fake_news(description):