Spaces:
Sleeping
Sleeping
File size: 925 Bytes
002fca8 2cd7197 5d26a98 dadb627 0099d95 c5f58d3 f0feabf d57ded5 498d80c 1ad1813 739823d d707be1 c550535 b916cdf c53513a 2cd7197 f7205b4 7f75cfc f7205b4 6159237 c550535 7a4300a f7205b4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
from fastapi.responses import JSONResponse
import requests
import os
import socket
import time
from enum import Enum
import random
import aiohttp
import asyncio
import json
#--------------------------------------------------- Definizione Server FAST API ------------------------------------------------------
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.post("/Movimenti")
async def generate_text(request: Request):
data = await request.json()
print(data)
return JSONResponse(content={"message": "Received", "data": data})
@app.get("/")
def read_general():
return {"response": "Benvenuto. Per maggiori info: https://matteoscript-RentriWebServer.hf.space/docs"} |