annie08 commited on
Commit
1c4bbad
·
1 Parent(s): b9b9728
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -26,12 +26,23 @@ def generate_caption(image):
26
 
27
  return generated_caption
28
 
 
 
 
 
 
 
29
  # Define the Gradio interface
30
  interface = gr.Interface(
31
  fn=generate_caption, # Function to process input
32
- inputs=gr.Image(), # Input as image
33
- outputs=gr.Textbox(), # Output as text
34
- live=True # Enable live prediction
 
 
 
 
 
35
  )
36
 
37
  # Launch the Gradio app
 
26
 
27
  return generated_caption
28
 
29
+ # # Examples for testing
30
+ # examples = [
31
+ # ["example_images/image1.jpg"], # Replace with paths to example images
32
+ # ["example_images/image2.jpg"]
33
+ # ]
34
+
35
  # Define the Gradio interface
36
  interface = gr.Interface(
37
  fn=generate_caption, # Function to process input
38
+ inputs=gr.Image(label="Upload an Image"), # Add a label to input
39
+ outputs=gr.Textbox(label="Generated Caption", lines=2), # Larger textbox for output
40
+ # examples=examples, # Add example images
41
+ live=True, # Enable live prediction
42
+ title="📸 Image Caption Generator", # Add a title
43
+ description="Upload an chest x-ray image to generate a descriptive caption using our AI model. Built with Transformers and Gradio.", # Add a description
44
+ theme="allenai/gradio-theme", # Use Gradio's built-in themes
45
+ css=".output { font-size: 16px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; }", # Custom CSS for output styling
46
  )
47
 
48
  # Launch the Gradio app