Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
from flask import Flask, request, jsonify
|
| 3 |
-
import requests
|
| 4 |
-
|
| 5 |
-
app = Flask(__name__)
|
| 6 |
-
|
| 7 |
-
@app.route("/")
|
| 8 |
-
def home():
|
| 9 |
-
return "Proxy API is working 💚"
|
| 10 |
-
|
| 11 |
-
@app.route("/proxy", methods=["POST"])
|
| 12 |
-
def proxy():
|
| 13 |
-
data = request.get_json()
|
| 14 |
-
image_url = data.get("image_url")
|
| 15 |
-
|
| 16 |
-
if not image_url:
|
| 17 |
-
return jsonify({"error": "image_url parametresi eksik"}), 400
|
| 18 |
-
|
| 19 |
-
try:
|
| 20 |
-
hf_response = requests.post(
|
| 21 |
-
"https://api-inference.huggingface.co/models/microsoft/conditional-image-captioning",
|
| 22 |
-
headers={"Authorization": "Bearer YOUR_HUGGINGFACE_API_KEY"},
|
| 23 |
-
json={"inputs": image_url}
|
| 24 |
-
)
|
| 25 |
-
return jsonify(hf_response.json())
|
| 26 |
-
except Exception as e:
|
| 27 |
-
return jsonify({"error": str(e)}), 500
|
| 28 |
-
|
| 29 |
-
if __name__ == "__main__":
|
| 30 |
-
app.run(host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|