File size: 573 Bytes
6af53a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from fastapi import FastAPI, Form
from pydantic import BaseModel
import requests

app = FastAPI()

# Define a model for the input data
class InputData(BaseModel):
    json_data: str

@app.post("/process")
async def process_data(json_data: str = Form(...)):
    url = 'https://bagustyo-fastapi-bagus.hf.space/process'
    headers = {
        'accept': 'text/html',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    data = {
        'json_data': json_data
    }

    response = requests.post(url, headers=headers, data=data)
    
    return response.text