jcsagar commited on
Commit
3e5c162
1 Parent(s): 1d02de0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -12,18 +12,19 @@ model = model.to("cuda")
12
 
13
  # Define the function to generate the report
14
  @spaces.GPU
15
- def generate_report(image):
16
  image = Image.open(image).convert("RGB")
17
- response = model.write_radiologic_report(image)
18
  return response
19
 
20
  # Create the Gradio interface
21
  interface = gr.Interface(
22
- fn=generate_report,
23
- inputs=gr.Image(type="filepath", label="Upload Image"),
 
24
  outputs=gr.Textbox(label="Report"),
25
  title="CXR Report Creator",
26
- description="Upload an image to use with the CXR-LLAVA-v2 model."
27
  )
28
 
29
  # Launch the interface with API enabled
 
12
 
13
  # Define the function to generate the report
14
  @spaces.GPU
15
+ def ask_question(question, image):
16
  image = Image.open(image).convert("RGB")
17
+ response = model.ask_question(question, image)
18
  return response
19
 
20
  # Create the Gradio interface
21
  interface = gr.Interface(
22
+ fn=ask_question,
23
+ inputs=[gr.Textbox(lines=1, placeholder="Enter your question here", label="Question"),
24
+ gr.Image(type="filepath", label="Upload Image")],
25
  outputs=gr.Textbox(label="Report"),
26
  title="CXR Report Creator",
27
+ description="Upload an image and enter a question to use with the CXR-LLAVA-v2 model."
28
  )
29
 
30
  # Launch the interface with API enabled