taesiri commited on
Commit
936d897
1 Parent(s): a4b7e70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -12
app.py CHANGED
@@ -66,16 +66,33 @@ def inference(image):
66
 
67
  return None # In case of unexpected errors
68
 
69
- # Create Gradio interface
70
- demo = gr.Interface(
71
- fn=inference,
72
- inputs=[
73
- gr.Image(type="pil", label="Upload Image")
74
- ],
75
- outputs=gr.Textbox(label="Response"),
76
- title="Image Analysis AI",
77
- description="Upload an image and ask a question about it. The AI will analyze and respond.",
78
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- if __name__ == "__main__":
81
- demo.launch()
 
66
 
67
  return None # In case of unexpected errors
68
 
69
+ # Create Gradio interface using Blocks
70
+ with gr.Blocks() as demo:
71
+ gr.Markdown("# BugsBunny-LLama-3.2-11B-Base-Medium Demo")
72
+
73
+ with gr.Row():
74
+ # Container for the image takes full width
75
+ with gr.Column(scale=1):
76
+ image_input = gr.Image(
77
+ type="pil",
78
+ label="Upload Image",
79
+ elem_id="large-image",
80
+ height=500, # Increased height for larger display
81
+ )
82
+
83
+ with gr.Row():
84
+ # Container for the text output takes full width
85
+ with gr.Column(scale=1):
86
+ text_output = gr.Textbox(
87
+ label="Response",
88
+ elem_id="response-text",
89
+ lines=25,
90
+ max_lines=10,
91
+ )
92
+
93
+ # Button to trigger the analysis
94
+ submit_btn = gr.Button("Analyze Image", variant="primary")
95
+ submit_btn.click(fn=inference, inputs=[image_input], outputs=[text_output])
96
+
97
 
98
+ demo.launch()