zting commited on
Commit
2ee4ae2
1 Parent(s): f7680bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -66,20 +66,19 @@ agent = initialize_agent(
66
  )
67
 
68
  import gradio as gr
69
- def segment(image):
70
  #pass # Implement your image segmentation model here...
71
  print(image)
72
  image_url = image
73
 
74
- return agent(f"Describe the following image:\n{image_url}").get('output').replace('The response to your last comment is','')
75
 
76
  demo = gr.Interface(
77
- segment,
78
  inputs=[
79
  gr.Image(type="filepath",shape=(200, 200)),
80
  gr.components.Textbox(label="Text"),
81
- ],
82
-
83
- "text")
84
  demo.launch()
85
 
 
66
  )
67
 
68
  import gradio as gr
69
+ def segment(image,text):
70
  #pass # Implement your image segmentation model here...
71
  print(image)
72
  image_url = image
73
 
74
+ return agent(f"{text}:\n{image_url}").get('output').replace('The response to your last comment is','')
75
 
76
  demo = gr.Interface(
77
+ fn=segment,
78
  inputs=[
79
  gr.Image(type="filepath",shape=(200, 200)),
80
  gr.components.Textbox(label="Text"),
81
+ ],
82
+ outputs=["text"])
 
83
  demo.launch()
84