Skip to content

Commit 0d4e252

Browse files
committed
done
1 parent 3cf80c9 commit 0d4e252

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed
316 Bytes
Binary file not shown.

Backend/texttoAIvideo.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
from fastapi import APIRouter, Request
1+
from fastapi import APIRouter, FastAPI
22
from fastapi.responses import JSONResponse
33

44
router = APIRouter()
5+
app = FastAPI()
56

67
@router.get('/api6')
7-
async def get_text_from_user(request: Request):
8-
request_body = await request.json()
9-
user_input = request_body.get("input_text", "")
10-
file_text = user_input[:200] # Read the first 200 characters from the user input
11-
8+
async def get_text_from_file():
9+
with open('input.txt', 'r') as file:
10+
file_text = file.read(200)
1211
return JSONResponse(content={"blendData": file_text})
12+
13+
@router.post('/api7')
14+
async def write_text_to_file(text: str):
15+
with open('input.txt', 'w') as file:
16+
file.write(text)
17+
return JSONResponse(content={"message": "Text successfully written to input.txt"})
18+
19+
app.include_router(router)

input.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fuck that niggaa
1+
hello i am Friday your personal assistant

0 commit comments

Comments
 (0)