Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 1.67 KB

File metadata and controls

75 lines (58 loc) · 1.67 KB

API Documentation

Health Prediction API

Streamlit Interface

  • URL: http://localhost:8501
  • Type: Web Interface
  • Features: Interactive dashboard, real-time monitoring, AI chat

Python API

from health_model.models.model import AdvancedHealthModel
import torch

model = AdvancedHealthModel(input_size=9)
model.load_state_dict(torch.load('health_model/models/saved/best_model.pth'))

# Predict
features = torch.FloatTensor([[0.5, 0.3, 0.7, 0.2, 0.8, 0.4, 0.6, 0.1, 0.9]])
prediction = model(features)

Image Classification API

Gradio Interface

  • URL: http://localhost:7860
  • Type: Web Interface
  • Input: Image upload
  • Output: Classification result with confidence

Python API

from src.predict import Predictor

predictor = Predictor('models/best_model.h5')
result = predictor.predict_image('path/to/image.jpg')

Sentiment Analysis API

Command Line

python imdb_sentiment/src/predict.py --text "Amazing movie!"

Python API

from imdb_sentiment.src.predict import SentimentPredictor

predictor = SentimentPredictor('imdb_sentiment/models/best_model.h5')
result = predictor.predict("Great film with excellent acting!")

Batch Processing

Health Data

# CSV format: feature1,feature2,...,feature9
import pandas as pd
data = pd.read_csv('health_data.csv')
# Process through Streamlit interface

Image Batch

# Multiple images
images = ['img1.jpg', 'img2.jpg', 'img3.jpg']
results = [predictor.predict_image(img) for img in images]

Text Batch

reviews = ["Good movie", "Bad film", "Excellent story"]
results = predictor.predict_batch(reviews)