Instructions to use OpenRAG128/bone_fracture with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorFlowTTS
How to use OpenRAG128/bone_fracture with TensorFlowTTS:
from tensorflow_tts.inference import TFAutoModel model = TFAutoModel.from_pretrained("OpenRAG128/bone_fracture") - Notebooks
- Google Colab
- Kaggle
| import os | |
| from flask import Flask, request, render_template | |
| from tensorflow.keras.models import load_model | |
| from tensorflow.keras.preprocessing import image | |
| import numpy as np | |
| app = Flask(__name__) | |
| # Load the trained model | |
| model = load_model('bone_fracture/bone_model.h5') # Update with your model's file path | |
| # Define class labels | |
| class_labels = ['Not Fractured', 'Fractured'] | |
| def index(): | |
| if request.method == 'POST': | |
| # Get the uploaded file from the form | |
| file = request.files['file'] | |
| if file: | |
| # Save the file temporarily | |
| temp_path = 'temp.jpg' | |
| file.save(temp_path) | |
| # Load and preprocess the image | |
| img = image.load_img(temp_path, target_size=(224, 224)) | |
| img_array = image.img_to_array(img) | |
| img_array = np.expand_dims(img_array, axis=0) | |
| img_array /= 255.0 | |
| # Make a prediction | |
| prediction = model.predict(img_array) | |
| predicted_class = int(np.round(prediction)[0][0]) | |
| predicted_label = class_labels[predicted_class] | |
| # Delete the temporary file | |
| os.remove(temp_path) | |
| return render_template('result.html', prediction=predicted_label) | |
| return render_template('index.html') | |
| if __name__ == '__main__': | |
| app.run(debug=True) | |