mgbam commited on
Commit
14f626b
·
verified ·
1 Parent(s): 0a8b1f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -3,7 +3,7 @@ from janus.janusflow.models import MultiModalityCausalLM, VLChatProcessor
3
  from PIL import Image
4
  from diffusers.models import AutoencoderKL
5
  import numpy as np
6
- import gradio as gr # Import gradio for UI
7
 
8
  # CUDA availability check
9
  cuda_device = 'cuda' if torch.cuda.is_available() else 'cpu'
@@ -176,6 +176,7 @@ def generate_image(prompt,
176
  return [Image.fromarray(images[i]).resize((1024, 1024), Image.LANCZOS) for i in range(images.shape[0])]
177
 
178
 
 
179
  # Gradio interface
180
  with gr.Blocks(title="JanusFlow Medical Image Assistant") as demo:
181
  gr.Markdown(value="# Medical Image Understanding and Generation")
@@ -197,16 +198,20 @@ with gr.Blocks(title="JanusFlow Medical Image Assistant") as demo:
197
  examples=[
198
  [
199
  "What are the visible structures in this ultrasound?",
200
- "./ultrasound.jpeg"
201
  ],
202
  [
203
  "Identify abnormalities in the image.",
204
- "./cardiac_ultrasound.jpeg"
205
  ],
206
  [
207
  "Describe the features and histological analysis in this image.",
208
- "./histology.jpeg"
209
  ],
 
 
 
 
210
  ],
211
  inputs=[question_input, image_input],
212
  )
@@ -244,4 +249,4 @@ with gr.Blocks(title="JanusFlow Medical Image Assistant") as demo:
244
  outputs=image_output
245
  )
246
 
247
- demo.launch(share=True)
 
3
  from PIL import Image
4
  from diffusers.models import AutoencoderKL
5
  import numpy as np
6
+ import gradio as gr
7
 
8
  # CUDA availability check
9
  cuda_device = 'cuda' if torch.cuda.is_available() else 'cpu'
 
176
  return [Image.fromarray(images[i]).resize((1024, 1024), Image.LANCZOS) for i in range(images.shape[0])]
177
 
178
 
179
+
180
  # Gradio interface
181
  with gr.Blocks(title="JanusFlow Medical Image Assistant") as demo:
182
  gr.Markdown(value="# Medical Image Understanding and Generation")
 
198
  examples=[
199
  [
200
  "What are the visible structures in this ultrasound?",
201
+ Image.open("ultrasound.jpeg"), # Load Directly
202
  ],
203
  [
204
  "Identify abnormalities in the image.",
205
+ Image.open("cardiac_ultrasound.jpeg"), # Load Directly
206
  ],
207
  [
208
  "Describe the features and histological analysis in this image.",
209
+ Image.open("histology.jpeg"), # Load Directly
210
  ],
211
+ [
212
+ "What are the characteristics and analysis of this image?",
213
+ Image.open("histology2.jpeg")
214
+ ]
215
  ],
216
  inputs=[question_input, image_input],
217
  )
 
249
  outputs=image_output
250
  )
251
 
252
+ demo.launch(share=False) # disabled share for HF Spaces