File size: 833 Bytes
4b1a7ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import grpc
import protos.agent_pb2 as agent_pb2
import protos.agent_pb2_grpc as agent_pb2_grpc
import logging as log

log.basicConfig(level=log.INFO)

def run():
    with grpc.insecure_channel('localhost:50051') as channel:
        stub = agent_pb2_grpc.CodeReviewAgentStub(channel)
        log.info("Sending ReviewPR request...")
        response_stream = stub.ReviewPR(agent_pb2.ReviewRequest(
            repo_url="https://github.com/huggingface/accelerate",
            pr_number=3321
        ))
        
        log.info("Waiting for stream...")
        for response in response_stream:
            log.info(f"--- Received Review for {response.file_path} ---")
            log.info(f"Status: {response.status}")
            log.info(response.review_comment)
            log.info("-" * 50)

if __name__ == '__main__':
    run()