jaynopponep commited on
Commit
d209660
·
1 Parent(s): 27be334
Files changed (2) hide show
  1. app.py +5 -3
  2. templates/home.html +1 -0
app.py CHANGED
@@ -1,10 +1,12 @@
1
  from flask import Flask, render_template, request, jsonify
2
  import model # Import your model module
 
3
 
4
  app = Flask(__name__)
5
 
6
  # Load the model and tokenizer here
7
- model, tokenizer = model.get_model(), model.get_tokenizer()
 
8
 
9
 
10
  @app.route('/', methods=['GET', 'POST'])
@@ -13,10 +15,10 @@ def home():
13
  data = request.json
14
  user_input = data['text']
15
  # Use your model to classify the text
16
- prediction = model.predict(model, user_input, tokenizer)
17
  return jsonify({'classification': prediction})
18
  return render_template('home.html')
19
 
20
 
21
  if __name__ == '__main__':
22
- app.run()
 
1
  from flask import Flask, render_template, request, jsonify
2
  import model # Import your model module
3
+ from transformers import BertTokenizer
4
 
5
  app = Flask(__name__)
6
 
7
  # Load the model and tokenizer here
8
+ loaded_model = model.get_model()
9
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
10
 
11
 
12
  @app.route('/', methods=['GET', 'POST'])
 
15
  data = request.json
16
  user_input = data['text']
17
  # Use your model to classify the text
18
+ prediction = model.predict(loaded_model, user_input, tokenizer)
19
  return jsonify({'classification': prediction})
20
  return render_template('home.html')
21
 
22
 
23
  if __name__ == '__main__':
24
+ app.run()
templates/home.html CHANGED
@@ -36,6 +36,7 @@
36
  resize: none; /* Prevents resizing manually */
37
  min-height: 50px; /* Minimum height */
38
  }
 
39
  </style>
40
  </head>
41
  <body>
 
36
  resize: none; /* Prevents resizing manually */
37
  min-height: 50px; /* Minimum height */
38
  }
39
+
40
  </style>
41
  </head>
42
  <body>