FacVain / dil-asistanim

1 stars 0 forks source link

Create RoBERTa-Request module #27

Open FacVain opened 4 months ago

FacVain commented 4 months ago

Task Description

Create a RoBERTa-Request module that handles communication with XMLRoBERTa models by sending requests to the Flask app.

Implementation Details

The module should provide an async function for the server which server can send the request that came from Frontend. This function must send requests to /predict endpoint and return sentiment and tone analysis responses as a JSON object.

Design and Tasks

Create roberta-request.js file that exports sendRequestToXMLRoBERTa(req) function. This function takes user input and send it to the /predict endpoint. Funciton returns sentiment and tone analysis responses as a JSON object named predictionResponse. Integrate this function in webserver so that both roberta and gpt responses are returned when the frontend sends a request for a write pattern improvement.

Expected Output

XMLRoBERTa output { "sentiment": max_sentiment_class as String, "tone": max_tone_class type as String } Response sent from webserver to frontend example for Dilekce pattern: { "robertaResponse": { "sentiment": max_sentiment_class as String, "tone": max_tone_class type as String }, "gptResponse": { "sentimentAnalysis": String, "toneAnalysis": String[], "improvedPetitionFromUserText": String, "suggestionForUserText": String } }

Acceptance Criteria

The function should reliably and correctly return the appropriate fields from XMLRoBERTa models.