jcsagar commited on
Commit
0506c40
·
verified ·
1 Parent(s): 2a472f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -9,11 +9,7 @@ model = AutoModel.from_pretrained("ECOFRI/CXR-LLAVA-v2", trust_remote_code=True)
9
  model = model.to("cuda" if torch.cuda.is_available() else "cpu")
10
 
11
  # Define the function to generate the report
12
- def generate_report(image, api_key):
13
- # Check the API key
14
- if api_key != os.getenv("API_KEY"):
15
- return "Unauthorized access. Invalid API key."
16
-
17
  image = Image.open(image).convert("RGB")
18
  response = model.write_radiologic_report(image)
19
  return response
@@ -21,10 +17,10 @@ def generate_report(image, api_key):
21
  # Create the Gradio interface
22
  interface = gr.Interface(
23
  fn=generate_report,
24
- inputs=[gr.Image(type="filepath", label="Upload Chest X-ray Image"), gr.Textbox(label="API Key")],
25
- outputs=gr.Textbox(label="Radiologic Report"),
26
- title="Chest X-ray Report Generator",
27
- description="Upload a chest X-ray image to generate a radiologic report using the CXR-LLAVA-v2 model."
28
  )
29
 
30
  # Launch the interface with API enabled
 
9
  model = model.to("cuda" if torch.cuda.is_available() else "cpu")
10
 
11
  # Define the function to generate the report
12
+ def generate_report(image):
 
 
 
 
13
  image = Image.open(image).convert("RGB")
14
  response = model.write_radiologic_report(image)
15
  return response
 
17
  # Create the Gradio interface
18
  interface = gr.Interface(
19
  fn=generate_report,
20
+ inputs=[gr.Image(type="filepath", label="Upload Image"), gr.Textbox(label="API Key")],
21
+ outputs=gr.Textbox(label="Report"),
22
+ title="CXR Report Creator",
23
+ description="Upload an image to use with the CXR-LLAVA-v2 model."
24
  )
25
 
26
  # Launch the interface with API enabled