from flask import Flask, request, jsonify | |
from gradio_client import Client | |
from flask_cors import CORS, cross_origin | |
app = Flask(__name__) | |
cors = CORS(app) | |
# Define the Gradio API endpoint | |
gradio_api_url = "https://astro21-test-2.hf.space/--replicas/x5m8s/" | |
# Function to summarize a file using the Gradio API | |
# Define a route to handle summarization requests | |
def summarize_text(): | |
if request.method == 'POST': | |
data = request.get_json() | |
file_content = data.get('file_content') | |
# app.logger.info(file_content) | |
result = summarize_file_with_gradio(file_content) | |
return jsonify(result) |