QQQ-XXX commited on
Commit
e52330c
·
1 Parent(s): f714100

add openai

Browse files
Files changed (2) hide show
  1. app.py +13 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -132,7 +132,19 @@ def process_image(
132
  image=image_input,
133
  task='<OD>'
134
  )
135
- caption = result
 
 
 
 
 
 
 
 
 
 
 
 
136
  _, result = run_florence_inference(
137
  model=FLORENCE_MODEL,
138
  processor=FLORENCE_PROCESSOR,
 
132
  image=image_input,
133
  task='<OD>'
134
  )
135
+ from openai import OpenAI
136
+ client = OpenAI()
137
+
138
+ completion = client.chat.completions.create(
139
+ model="gpt-4o",
140
+ messages=[
141
+ {"role": "system", "content": "You are a helpful assistant."},
142
+ {"role": "user", "content": "Hello!"}
143
+ ]
144
+ )
145
+
146
+ print(completion.choices[0].message.content)
147
+ caption = ', '.join(result['<OD>']['labels'])
148
  _, result = run_florence_inference(
149
  model=FLORENCE_MODEL,
150
  processor=FLORENCE_PROCESSOR,
requirements.txt CHANGED
@@ -7,4 +7,5 @@ samv2
7
  gradio
8
  supervision
9
  opencv-python
10
- pytest
 
 
7
  gradio
8
  supervision
9
  opencv-python
10
+ pytest
11
+ openai