Spaces:
Sleeping
Sleeping
Download app.py from hubapihosting/hubAPI: direct link, hf CLI and curl.
- Browser
- Download file 535 Bytes
-
https://huggingface.co/spaces/hubapihosting/hubAPI/resolve/main/app.py
- Command line
-
hf download hf://spaces/hubapihosting/hubAPI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hubapihosting/hubAPI/resolve/main/app.py
535 Bytes
| from flask import Flask, request, jsonify | |
| import random | |
| app = Flask(__name__) | |
| URLS = [ | |
| "https://science.yangplace.qzz.io", | |
| "http://10.14.0.145:8080", | |
| ] | |
| def get_url(): | |
| failed = request.args.get("failed") | |
| urls = URLS.copy() | |
| if not urls: | |
| return jsonify({"error": "URL list is empty"}) | |
| if failed: | |
| urls = [u for u in urls if u != failed] | |
| if not urls: | |
| return jsonify({"error": "No URLs remaining after filtering"}) | |
| return jsonify({"url": random.choice(urls)}) | |