tonyliu404 commited on
Commit
95c0ea1
·
verified ·
1 Parent(s): b7a7936

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -330,6 +330,7 @@ if uploaded_image and recipe_submit:
330
  st.image(input_image, caption="Uploaded Image.", use_container_width=True)
331
 
332
  predictions = classifyImage(input_image)
 
333
  fpredictions = ""
334
 
335
  # Show the top predictions with percentages
@@ -377,12 +378,16 @@ if uploaded_image and recipe_submit:
377
  ),
378
  ]
379
 
380
- # Call the OpenAI API
381
- openAIresponse = llm.invoke(openAICall)
382
- print("AI CALL RESPONSE: ", openAIresponse.content, "END AI CALL RESONSE")
383
-
384
- RAGresponse = get_response(openAIresponse.content + " " + query)
 
 
 
385
  print("RAGresponse: ", RAGresponse)
 
386
  with st.expander("Recipe Generation", expanded=True, icon=':material/menu_book:'):
387
  st.title('Results: RAG')
388
  display_response(RAGresponse)
 
330
  st.image(input_image, caption="Uploaded Image.", use_container_width=True)
331
 
332
  predictions = classifyImage(input_image)
333
+ print("Predictions: ", predictions)
334
  fpredictions = ""
335
 
336
  # Show the top predictions with percentages
 
378
  ),
379
  ]
380
 
381
+ if query:
382
+ # Call the OpenAI API
383
+ openAIresponse = llm.invoke(openAICall)
384
+ print("AI CALL RESPONSE: ", openAIresponse.content, "END AI CALL RESONSE")
385
+
386
+ RAGresponse = get_response(openAIresponse.content + " " + query)
387
+ else:
388
+ RAGresponse = predictions[0]
389
  print("RAGresponse: ", RAGresponse)
390
+
391
  with st.expander("Recipe Generation", expanded=True, icon=':material/menu_book:'):
392
  st.title('Results: RAG')
393
  display_response(RAGresponse)