yassonee commited on
Commit
9f1f60f
·
verified ·
1 Parent(s): 20b50b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -3,6 +3,16 @@ from transformers import pipeline
3
  from PIL import Image, ImageDraw
4
  import numpy as np
5
  import colorsys
 
 
 
 
 
 
 
 
 
 
6
 
7
  st.set_page_config(
8
  page_title="Fraktur Detektion",
@@ -10,6 +20,15 @@ st.set_page_config(
10
  initial_sidebar_state="collapsed"
11
  )
12
 
 
 
 
 
 
 
 
 
 
13
  st.markdown("""
14
  <style>
15
  .stApp {
 
3
  from PIL import Image, ImageDraw
4
  import numpy as np
5
  import colorsys
6
+ from streamlit.web.server.server import Server
7
+ import streamlit.components.v1 as components
8
+
9
+ # Add WebSocket headers configuration
10
+ if Server.get_current():
11
+ Server.get_current()._websocket_headers = {
12
+ "Access-Control-Allow-Origin": "*",
13
+ "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
14
+ "Access-Control-Allow-Headers": "Content-Type"
15
+ }
16
 
17
  st.set_page_config(
18
  page_title="Fraktur Detektion",
 
20
  initial_sidebar_state="collapsed"
21
  )
22
 
23
+ # Add Edge WebSocket compatibility
24
+ components.html("""
25
+ <script>
26
+ if (window.WebSocket && navigator.userAgent.indexOf("Edge") > -1) {
27
+ window.WebSocket = window.WebSocket || window.MozWebSocket;
28
+ }
29
+ </script>
30
+ """, height=0)
31
+
32
  st.markdown("""
33
  <style>
34
  .stApp {