Araeynn commited on
Commit
c6d46a6
1 Parent(s): 1bdbce8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -1,4 +1,7 @@
1
  import socketserver
 
 
 
2
 
3
  class TCPHandler(socketserver.StreamRequestHandler):
4
  """
@@ -21,11 +24,21 @@ class TCPHandler(socketserver.StreamRequestHandler):
21
  self.wfile.write(self.bytes.upper())
22
 
23
 
24
- if __name__ == "__main__":
25
- HOST, PORT = "localhost", 9999
26
 
27
- # Create the server, binding to localhost on port 9999
28
- with socketserver.TCPServer((HOST, PORT), TCPHandler) as server:
29
- # Activate the server; this will keep running until you
30
- # interrupt the program with Ctrl-C
31
- server.serve_forever()
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import socketserver
2
+ import multiprocessing as mp
3
+
4
+ print("Started App.")
5
 
6
  class TCPHandler(socketserver.StreamRequestHandler):
7
  """
 
24
  self.wfile.write(self.bytes.upper())
25
 
26
 
 
 
27
 
28
+ HOST, PORT = "localhost", 9999
29
+ def serverActivate():
30
+ with socketserver.TCPServer((HOST, PORT), TCPHandler) as server:
31
+ server.serve_forever()
32
+
33
+ def start():
34
+ import gradio as gr
35
+
36
+ def op():
37
+ return ""
38
+
39
+ demo = gr.Interface(fn=greet, outputs="textbox")
40
+
41
+ demo.launch(share=True)
42
+
43
+ mp.Process(start).start()
44
+ mp.Process(serverActivate).start()