Hgodwarrior commited on
Commit
db8c654
·
verified ·
1 Parent(s): 891aed9

Upload server.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. server.py +13 -0
server.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import http.server
2
+ import socketserver
3
+ import os
4
+
5
+ PORT = int(os.environ.get("PORT", 7860))
6
+
7
+ os.chdir(os.path.dirname(os.path.abspath(__file__)))
8
+
9
+ Handler = http.server.SimpleHTTPRequestHandler
10
+
11
+ with socketserver.TCPServer(("0.0.0.0", PORT), Handler) as httpd:
12
+ print(f"Serving at http://0.0.0.0:{PORT}")
13
+ httpd.serve_forever()