Update app.py
Browse files
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
|
| 16 |
image = Image.open(image).convert("RGB")
|
| 17 |
-
response = model.
|
| 18 |
return response
|
| 19 |
|
| 20 |
# Create the Gradio interface
|
| 21 |
interface = gr.Interface(
|
| 22 |
-
fn=
|
| 23 |
-
inputs=gr.
|
|
|
|
| 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
|