File size: 680 Bytes
feec7ea
 
 
3c32f33
feec7ea
 
3c32f33
 
 
 
095882d
3c32f33
 
feec7ea
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
@app.route('/summarize', methods=['GET' , 'POST'])
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)