prateekbh commited on
Commit
bc3802f
·
verified ·
1 Parent(s): ef0bd2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -12
app.py CHANGED
@@ -1,16 +1,32 @@
1
  import gradio as gr
 
 
2
 
3
- def generate_description(image):
4
- # Your product description generation code goes here
5
- # For this example, let's just return a placeholder description
6
- return "This is a placeholder description for the uploaded product image."
7
 
8
- # Define the input and output components for the interface
9
- input_image = gr.inputs.Image(label="Upload Product Image")
10
- submit_button = gr.inputs.Button(text="Generate Description")
11
- output_text = gr.outputs.Textbox(label="Product Description")
 
 
 
 
12
 
13
- # Create the Gradio interface
14
- title = "Product Description Generator"
15
- description = "Upload an image of a product, and this app will generate a description for it."
16
- gr.Interface(generate_description, inputs=input_image, outputs=output_text, title=title, description=description, theme="compact").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import spaces
3
+ import argparse
4
 
 
 
 
 
5
 
6
+ parser = argparse.ArgumentParser()
7
+ # parser.add_argument("--device", type=str, default="cuda:0")
8
+ # parser.add_argument("--ckpt_path", type=str, default="./salmonn_7b_v0.pth")
9
+ # parser.add_argument("--whisper_path", type=str, default="./whisper_large_v2")
10
+ # parser.add_argument("--beats_path", type=str, default="./beats/BEATs_iter3_plus_AS2M_finetuned_on_AS2M_cpt2.pt")
11
+ # parser.add_argument("--vicuna_path", type=str, default="./vicuna-7b-v1.5")
12
+ # parser.add_argument("--low_resource", action='store_true', default=False)
13
+ parser.add_argument("--port", default=9527)
14
 
15
+ args = parser.parse_args()
16
+ args.low_resource = True
17
+
18
+ title = """<h1 style="text-align: center;">Product description generator</h1>"""
19
+ css = """
20
+ div#col-container {
21
+ margin: 0 auto;
22
+ max-width: 840px;
23
+ }
24
+ """
25
+
26
+ with gr.Blocks(css=css) as demo:
27
+ with gr.Column(elem_id="col-container"):
28
+ gr.HTML(title)
29
+ gr.Image(type="pil")
30
+
31
+
32
+ demo.launch()