andreska commited on
Commit
bbc50ae
·
verified ·
1 Parent(s): bf9d264

Convert to using PostMessage

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -35,6 +35,14 @@ with gr.Blocks() as iface:
35
  outputs=output
36
  )
37
 
 
 
 
 
 
 
 
 
38
  iface.launch(
39
  server_name="0.0.0.0", # Allow external connections
40
  share=True, # Create public URL
 
35
  outputs=output
36
  )
37
 
38
+ # Listen for post messages
39
+ def handle_message(event):
40
+ #if event.origin == 'http://your-angular-app-domain': # Check origin for security
41
+ data = event.data
42
+ update_values(data['context'], data['question'])
43
+
44
+ window.addEventListener('message', handle_message)
45
+
46
  iface.launch(
47
  server_name="0.0.0.0", # Allow external connections
48
  share=True, # Create public URL