Spaces:
Runtime error
Runtime error
Download app.py from apophis51/FlaskProject: direct link, hf CLI and curl.
- Browser
- Download file 653 Bytes
-
https://huggingface.co/spaces/apophis51/FlaskProject/resolve/main/app.py
- Command line
-
hf download hf://spaces/apophis51/FlaskProject/app.py
-
curl -L -o app.py https://huggingface.co/spaces/apophis51/FlaskProject/resolve/main/app.py
653 Bytes
| from flask import Flask, request, jsonify | |
| from transformers import pipeline | |
| app = Flask(__name__) | |
| pipe = pipeline("text2text-generation", | |
| model="google/flan-t5-small") | |
| def hello_world(): | |
| return 'Hello, World!' | |
| def process_ai_request(): | |
| data = request.get_json() | |
| input_text = data.get('input_text') | |
| # Process the input_text as needed | |
| # Here, we're just returning the received text for demonstration purposes | |
| #response_text = f"Processed input: {input_text}" | |
| response_text = pipe(input_text) | |
| return jsonify({"response": response_text[0]["generated_text"]}), 200 |