Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
-
import
|
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 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
st.image(img, caption="Uploaded Image.", use_column_width=True)
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
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()
|