Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,11 @@ from PIL import Image
|
|
| 3 |
import requests
|
| 4 |
import io
|
| 5 |
import base64
|
|
|
|
| 6 |
|
| 7 |
# --- CONFIGURATION ---
|
| 8 |
-
#
|
| 9 |
-
GROQ_API_KEY = "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"
|
| 10 |
GROQ_API_URL = "https://api.groq.com/v1/inference/yolov8"
|
| 11 |
|
| 12 |
# --- Streamlit UI ---
|
|
@@ -52,11 +53,7 @@ if uploaded_file is not None:
|
|
| 52 |
object_names = [obj['class'] for obj in detected_objects]
|
| 53 |
st.write(f"Detected items: {object_names}")
|
| 54 |
|
| 55 |
-
# Optional: show bounding boxes if API supports (not visualized here)
|
| 56 |
-
|
| 57 |
else:
|
| 58 |
st.error(f"Error: {response.status_code} - {response.text}")
|
| 59 |
|
| 60 |
-
---
|
| 61 |
-
|
| 62 |
st.write("Made with ❤️ using YOLOv8 + Groq + Streamlit")
|
|
|
|
| 3 |
import requests
|
| 4 |
import io
|
| 5 |
import base64
|
| 6 |
+
import os
|
| 7 |
|
| 8 |
# --- CONFIGURATION ---
|
| 9 |
+
# Get Groq API key from environment variables (set in Hugging Face Secrets)
|
| 10 |
+
GROQ_API_KEY = os.getenv("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")
|
| 11 |
GROQ_API_URL = "https://api.groq.com/v1/inference/yolov8"
|
| 12 |
|
| 13 |
# --- Streamlit UI ---
|
|
|
|
| 53 |
object_names = [obj['class'] for obj in detected_objects]
|
| 54 |
st.write(f"Detected items: {object_names}")
|
| 55 |
|
|
|
|
|
|
|
| 56 |
else:
|
| 57 |
st.error(f"Error: {response.status_code} - {response.text}")
|
| 58 |
|
|
|
|
|
|
|
| 59 |
st.write("Made with ❤️ using YOLOv8 + Groq + Streamlit")
|