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 | |
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 |