Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ from langchain.document_loaders import PyPDFLoader
|
|
| 9 |
import os
|
| 10 |
import fitz
|
| 11 |
from PIL import Image
|
|
|
|
| 12 |
|
| 13 |
# Global variables
|
| 14 |
COUNT, N = 0, 0
|
|
@@ -121,7 +122,15 @@ if __name__ == "__main__":
|
|
| 121 |
"text" # Define txt
|
| 122 |
],
|
| 123 |
title="PDF-Powered Chatbot"
|
| 124 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
|
| 127 |
|
|
|
|
| 9 |
import os
|
| 10 |
import fitz
|
| 11 |
from PIL import Image
|
| 12 |
+
import socket
|
| 13 |
|
| 14 |
# Global variables
|
| 15 |
COUNT, N = 0, 0
|
|
|
|
| 122 |
"text" # Define txt
|
| 123 |
],
|
| 124 |
title="PDF-Powered Chatbot"
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
def find_free_port():
|
| 128 |
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
| 129 |
+
s.bind(('', 0))
|
| 130 |
+
return s.getsockname()[1]
|
| 131 |
+
|
| 132 |
+
free_port = find_free_port()
|
| 133 |
+
interface.launch(server_port=free_port)
|
| 134 |
|
| 135 |
|
| 136 |
|