test / README.md
yummyu's picture
Update README.md
570d38b verified
metadata
title: FastAPI with Hugging Face
emoji: 🤗
colorFrom: blue
colorTo: green
sdk: docker
pinned: false

FastAPI with Hugging Face Transformers

This Space provides a FastAPI-based API for text processing using Hugging Face Transformers.

Features

  • Sentiment Analysis: Analyze the sentiment of text
  • Text Generation: Generate text based on prompts
  • RESTful API: Clean API endpoints with automatic documentation

API Endpoints

  • GET / - Health check
  • POST /sentiment - Sentiment analysis
  • POST /generate - Text generation
  • GET /models - Available models info
  • GET /docs - API documentation (Swagger UI)

Usage

Sentiment Analysis

curl -X POST "https://your-space-name.hf.space/sentiment" \
     -H "Content-Type: application/json" \
     -d '{"text": "I love this product!"}'

Text Generation

curl -X POST "https://your-space-name.hf.space/generate" \
     -H "Content-Type: application/json" \
     -d '{"text": "Once upon a time", "max_length": 50}'

Interactive Documentation

Visit https://your-space-name.hf.space/docs for interactive API documentation.

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference