gwgue / main.py
bagustyo's picture
Create main.py
6af53a6 verified
raw
history blame contribute delete
573 Bytes
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