Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -112,6 +112,7 @@ async def upload_img(
|
|
112 |
return {"message": "image uploaded successfully."}
|
113 |
|
114 |
|
|
|
115 |
@app.post("/process/")
|
116 |
async def process_item(prompts: List[str] = Form(...)):
|
117 |
if not img_list: # Check if img_list is empty or None
|
@@ -121,8 +122,9 @@ async def process_item(prompts: List[str] = Form(...)):
|
|
121 |
responses = []
|
122 |
|
123 |
for prompt in prompts:
|
|
|
124 |
chat.ask(prompt, chat_state)
|
125 |
-
chatbot
|
126 |
llm_message = chat.answer(conv=chat_state, img_list=img_list, max_new_tokens=300, num_beams=1, temperature=1, max_length=2000)[0]
|
127 |
chatbot[-1][1] = llm_message
|
128 |
responses.append({
|
|
|
112 |
return {"message": "image uploaded successfully."}
|
113 |
|
114 |
|
115 |
+
|
116 |
@app.post("/process/")
|
117 |
async def process_item(prompts: List[str] = Form(...)):
|
118 |
if not img_list: # Check if img_list is empty or None
|
|
|
122 |
responses = []
|
123 |
|
124 |
for prompt in prompts:
|
125 |
+
# Process each prompt individually
|
126 |
chat.ask(prompt, chat_state)
|
127 |
+
chatbot.append([prompt, None])
|
128 |
llm_message = chat.answer(conv=chat_state, img_list=img_list, max_new_tokens=300, num_beams=1, temperature=1, max_length=2000)[0]
|
129 |
chatbot[-1][1] = llm_message
|
130 |
responses.append({
|