MalikShehram commited on
Commit
00b79f4
·
verified ·
1 Parent(s): 165d2ad

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Function to process the uploaded image and details
4
+ def process_clothing(image, price, status):
5
+ # Display the image, price, and status
6
+ result = f"""
7
+ <div style="text-align: center;">
8
+ <h2>Clothing Details</h2>
9
+ <img src="{image}" alt="Clothing Image" style="max-width: 300px; border-radius: 10px;">
10
+ <p><strong>Price:</strong> ${price}</p>
11
+ <p><strong>Status:</strong> {status}</p>
12
+ </div>
13
+ """
14
+ return result
15
+
16
+ # Gradio Interface
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown("# 🛍️ Clothing Buy/Sell App")
19
+ gr.Markdown("Upload a picture of your clothing item, add the price, and mark it as 'For Sale' or 'Sold'.")
20
+
21
+ with gr.Row():
22
+ with gr.Column():
23
+ image_input = gr.Image(label="Upload Clothing Image", type="filepath")
24
+ price_input = gr.Number(label="Price ($)", value=0)
25
+ status_input = gr.Radio(choices=["For Sale", "Sold"], label="Status")
26
+ submit_button = gr.Button("Submit")
27
+
28
+ with gr.Column():
29
+ output_html = gr.HTML(label="Clothing Details")
30
+
31
+ # Link the function to the interface
32
+ submit_button.click(
33
+ fn=process_clothing,
34
+ inputs=[image_input, price_input, status_input],
35
+ outputs=output_html
36
+ )
37
+
38
+ # Launch the app
39
+ if __name__ == "__main__":
40
+ demo.launch()