Skip to content
Permalink
Browse files
Create web service
  • Loading branch information
sravanvijs committed Dec 16, 2022
1 parent a250ceb commit 225dacdc9099c15d9dc3c05af1cc3dd65bed1649
Showing 1 changed file with 35 additions and 0 deletions.
@@ -0,0 +1,35 @@
Import necessary libraries
import tensorflow as tf
from keras.models import load_model
from flask import Flask, request

# Initialize the Flask app
app = Flask(_name_)

# Define the API endpoint
@app.route('/greet', methods=['GET'])
def greet():

#get response value
data = request.args.get('name')
# Load the model
model = load_model('model.h5')

# Define any preprocessing functions
def preprocess_data(data):
# Perform necessary preprocessing steps
return processed_data

# Extract the input data from the API request
data = request.get_json()

# Preprocess the data
processed_data = preprocess_data(data)

# Make a prediction using the model
prediction = model.predict(processed_data)

return jsonify(prediction)

if _name_ == '_main_':
app.run()

0 comments on commit 225dacd

Please sign in to comment.