Spaces:
Build error
Build error
taskswithcode
commited on
Commit
·
914b677
1
Parent(s):
89ed471
Update app.py
Browse files
app.py
CHANGED
@@ -127,23 +127,26 @@ def inference(img):
|
|
127 |
}
|
128 |
)
|
129 |
object_list_str.append(
|
130 |
-
f"{predicted_label} - X:{int(x0)} Y: {int(y0)} Width {int(width)} Height: {int(height)}
|
131 |
)
|
132 |
|
133 |
-
|
|
|
|
|
|
|
134 |
|
135 |
return (
|
136 |
Image.fromarray(np.uint8(out.get_image())).convert("RGB"),
|
137 |
-
|
138 |
)
|
139 |
|
140 |
|
141 |
with gr.Blocks() as demo:
|
142 |
gr.Markdown("# Detic+ChatGPT")
|
143 |
-
gr.Markdown("Use Detic to detect objects in an image and then
|
144 |
|
145 |
#gr.HTML("<p>You can duplicating this space and use your own session token: <a style='display:inline-block' href='https://huggingface.co/spaces/yizhangliu/chatGPT?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14' alt='Duplicate Space'></a></p>")
|
146 |
-
gr.HTML("<p> Instruction on how to get session token can be seen in video <a style='display:inline-block' href='https://www.youtube.com/watch?v=TdNSj_qgdFk'><font style='color:blue;weight:bold;'>here</font></a>. Add your session token by going to settings and add under secrets. </p>")
|
147 |
|
148 |
with gr.Column():
|
149 |
inp = gr.Image(label="Input Image", type="filepath")
|
|
|
127 |
}
|
128 |
)
|
129 |
object_list_str.append(
|
130 |
+
f"{predicted_label} - X:{int(x0)} Y: {int(y0)} Width: {int(width)} Height: {int(height)}"
|
131 |
)
|
132 |
|
133 |
+
|
134 |
+
output_str = "Imagine you are an intelligent image captioner. For each object in a scene the X, Y coordinates and width, height are given below. Use them to describe in detail each object in the scene. In the end give an overall summary of scene\n"
|
135 |
+
for line in object_list_str:
|
136 |
+
output_str += line + "\n"
|
137 |
|
138 |
return (
|
139 |
Image.fromarray(np.uint8(out.get_image())).convert("RGB"),
|
140 |
+
output_str
|
141 |
)
|
142 |
|
143 |
|
144 |
with gr.Blocks() as demo:
|
145 |
gr.Markdown("# Detic+ChatGPT")
|
146 |
+
gr.Markdown("Use Detic to detect objects in an image and then copy/paste into ChatGPT playground to describe the image.")
|
147 |
|
148 |
#gr.HTML("<p>You can duplicating this space and use your own session token: <a style='display:inline-block' href='https://huggingface.co/spaces/yizhangliu/chatGPT?duplicate=true'><img src='https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14' alt='Duplicate Space'></a></p>")
|
149 |
+
#gr.HTML("<p> Instruction on how to get session token can be seen in video <a style='display:inline-block' href='https://www.youtube.com/watch?v=TdNSj_qgdFk'><font style='color:blue;weight:bold;'>here</font></a>. Add your session token by going to settings and add under secrets. </p>")
|
150 |
|
151 |
with gr.Column():
|
152 |
inp = gr.Image(label="Input Image", type="filepath")
|