metadata
title: FastAPI Web App
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
FastAPI Web Application for Hugging Face Spaces
This is a simple FastAPI web application deployed on Hugging Face Spaces. It provides:
- A clean web interface showing the current server time
- A REST API with endpoints for getting the current time and echoing data
- Cross-origin resource sharing (CORS) support for API access from other domains
- Interactive API documentation via Swagger UI at
/docs
API Endpoints
/api/time
- GET request that returns the current server time/api/echo
- POST request that echoes back any JSON data sent to it
Local Development
To run this application locally:
Install the required dependencies:
pip install -r requirements.txt
Run the FastAPI application:
python app.py
Open your browser and navigate to
http://localhost:7860
- For API documentation, visit
http://localhost:7860/docs
- For API documentation, visit
Deployment
This application is configured for deployment on Hugging Face Spaces using Docker.