Thanks for your post and welcome to our forums, @Arun2594!
Can you please provide a bit more details about the issue you’re facing?
Thanks,
Charly
Please provide a bit more details about the issue you’re facing. So that I can help you with the issue You’re facing!
Below Two solution Steps You can try
- Check firewall and proxy settings: If you’re running Streamlit on your local machine or within a corporate network, make sure that your firewall or proxy settings are not blocking the connection. You may need to configure your firewall or proxy to allow Streamlit’s traffic.
- Update Streamlit and dependencies: Ensure that you’re using the latest version of Streamlit and its dependencies. You can update Streamlit using
pip install --upgrade streamlit
. Outdated versions of Streamlit or its dependencies may have compatibility issues that can cause connection errors.
i have tried both but it still the result has not come
Actually, I’m facing connection error problem.
1.while uploading the image its running, but while extracting that same image got connection error
2. I have resolved firewall and proxy setting, also updated the streamlit version
3. The code is also fine, and I don’t know the exact issue
Okay , Got it !
Confirm the image extraction method: Verify that the method you are using to extract the image is correct and compatible with Streamlit. Ensure that you are using the appropriate libraries or functions to handle the extraction process.
Consider image size or format issues: Large image sizes or unsupported image formats can sometimes cause issues. If you are extracting a particularly large image, it could lead to a connection error. Additionally, confirm that the image format is supported by the image processing library you are using.
Update Streamlit and relevant libraries: Ensure that you are using the latest version of Streamlit and any associated libraries or dependencies. Updating to the latest versions can sometimes resolve compatibility or bug-related issues.
Try the above solution and let me know if you face the same issue !
no change- it shows same error
@Arun2594 could you share a bit of code so I could see why you are getting the error, especially for the image extraction part as thats where you mention the problem is. Also are you using this repo for this project (GitHub - IamJafar/BizCardX-Extracting_Business_Card_Data_with_OCR: Data Extraction from Business Cards using easyOCR | Streamlit GUI | SQL Database)? Because if you are I couldn’t get it to run as the code as multiple OMP lib errors causing the app to crash.
if uploaded_card is not None:
def save_card(uploaded_card):
with open(os.path.join("uploaded_cards", uploaded_card.name), "wb") as f:
f.write(uploaded_card.getbuffer())
save_card(uploaded_card)
def image_preview(image, res):
for (bbox, text, prob) in res:
# unpack the bounding box
(tl, tr, br, bl) = bbox
tl = (int(tl[0]), int(tl[1]))
tr = (int(tr[0]), int(tr[1]))
br = (int(br[0]), int(br[1]))
bl = (int(bl[0]), int(bl[1]))
cv2.rectangle(image, tl, br, (0, 255, 0), 2)
cv2.putText(image, text, (tl[0], tl[1] - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 0, 0), 2)
plt.rcParams['figure.figsize'] = (15, 15)
plt.axis('off')
plt.imshow(image)
# DISPLAYING THE UPLOADED CARD
col1, col2 = st.columns(2, gap="large")
with col1:
st.markdown("# ")
st.markdown("# ")
st.markdown("### You have uploaded the card")
st.image(uploaded_card)
# DISPLAYING THE CARD WITH HIGHLIGHTS
with col2:
st.markdown("# ")
st.markdown("# ")
with st.spinner("Please wait processing image..."):
st.set_option('deprecation.showPyplotGlobalUse', False)
saved_img = os.getcwd() + "\\" + "uploaded_cards" + "\\" + uploaded_card.name
st.write("Image Path:", saved_img) # Debugging statement
image = cv2.imread(saved_img)
st.write("Image Shape:", image.shape) # Debugging statement
res = reader.readtext(saved_img)
st.markdown("### Image Processed and Data Extracted")
st.pyplot(image_preview(image, res))
# easy OCR
saved_img = os.getcwd() + "\\" + "uploaded_cards" + "\\" + uploaded_card.name
result = reader.readtext(saved_img, detail=0, paragraph=False)
st.write("OCR Result:", result) # Debugging statement
Can you please edit your post and put all of your code in a codeblock? Otherwise it is much more difficult to read and test your code.
One more general suggestion – does a very basic streamlit app work? For example, can you do this?
import streamlit as st
st.write("Hello world")
Or are you experiencing the same issue even with that simpler example?
Also, does the streamlit run
command crash? Or does it still seem to be running?
What is the smallest possible version of your app that still crashes?