smishr-18 commited on
Commit
0ee8759
·
1 Parent(s): acb1ede

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -1,15 +1,18 @@
1
- import streamlit as st
2
  import cv2
3
  from llm import llm
4
  import numpy as np
5
- image = st.file_uploader("Choose a Clear Image of the Neutrition Facts Table", type=["jpg", "jpeg", "png"])
6
 
7
- # Display the uploaded image
8
- if image is not None:
9
- image = np.asarray(bytearray(image.read()), dtype=np.uint8)
10
-
11
- # Read the image using OpenCV
12
- img = cv2.imdecode(image, cv2.IMREAD_COLOR)
13
- st.image(img, caption="Uploaded Image.", use_column_width=True)
14
 
15
- st.markdown(llm(img))
 
 
 
 
 
 
1
+ import gradio as gr
2
  import cv2
3
  from llm import llm
4
  import numpy as np
 
5
 
6
+ def process_image(image):
7
+ # Convert Gradio Image to OpenCV format
8
+ img = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
9
+
10
+ # Perform your image processing
11
+ result = llm(img)
 
12
 
13
+ return result
14
+
15
+ iface = gr.Interface(fn=process_image, inputs="image", outputs=gr.Markdown(), live=True, title="Nutrition Content Based LLM", description="The llm based project needs a clear image of only the Nutrition Facts Box at the back of a product, \n The llm shows the content and give health advice based on the Nutritions Facts.")
16
+
17
+
18
+ iface.launch()