Skip to content

Commit

Permalink
Merge branch 'frontend-design' of https://github.com/EchoSkorJjj/IS21…
Browse files Browse the repository at this point in the history
…3-Education-Helper into frontend-design
  • Loading branch information
iamlouisteo committed Feb 27, 2024
2 parents 79baadb + 08be3ed commit 12579eb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 39 deletions.
2 changes: 1 addition & 1 deletion backend/simple/fileprocessor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . /app

# Set the default command to run the app
CMD ["python3", "-m", "file_processor.service"]
CMD ["python3", "/app/file_processor/service.py"]
4 changes: 3 additions & 1 deletion backend/simple/fileprocessor/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '3'
version: "3"
services:
pdf-reader:
build:
context: .
ports:
- "50051:50051"
volumes:
- ./example.pdf:/app/example.pdf
Binary file not shown.
Binary file not shown.
26 changes: 26 additions & 0 deletions backend/simple/fileprocessor/file_processor/service_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import asyncio
import grpc
import file_processor_pb2
import file_processor_pb2_grpc

async def process_file_stub(pdf_bytes, filename, file_id):
async with grpc.aio.insecure_channel('localhost:50051') as channel:
stub = file_processor_pb2_grpc.FileProcessorStub(channel)
request = file_processor_pb2.FileUploadRequest(
file=pdf_bytes,
filename=filename,
fileId=file_id
)
response = await stub.ProcessFile(request)
return response

async def main():
input_pdf_bytes = b'<PDF_BYTES_HERE>' # Replace <PDF_BYTES_HERE> with actual PDF bytes
filename = "example.pdf"
file_id = "12345678-abcd-1234-abcd-1234567890ab"

response = await process_file_stub(input_pdf_bytes, filename, file_id)
print(response)

if __name__ == "__main__":
asyncio.run(main())
37 changes: 0 additions & 37 deletions backend/simple/fileprocessor/protos/file_processor.proto

This file was deleted.

0 comments on commit 12579eb

Please sign in to comment.