Upload server.py with huggingface_hub
Browse files
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()
|