Spaces:
Running
Running
Upload 4 files
Browse files- Dockerfile +24 -0
- main.py +44 -0
- requirements.txt +14 -0
- requirements_nodeps.txt +1 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
RUN useradd -m -u 1000 user
|
4 |
+
|
5 |
+
WORKDIR /code
|
6 |
+
|
7 |
+
COPY ./requirements.txt /code/requirements.txt
|
8 |
+
COPY ./requirements_nodeps.txt /code/requirements_nodeps.txt
|
9 |
+
|
10 |
+
USER root
|
11 |
+
RUN chown -R user:user /code
|
12 |
+
|
13 |
+
USER user
|
14 |
+
|
15 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
16 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements_nodeps.txt --no-deps
|
17 |
+
|
18 |
+
# RUN pip show uvicorn
|
19 |
+
|
20 |
+
COPY --chown=user:user . /code
|
21 |
+
|
22 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
23 |
+
|
24 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import time
|
3 |
+
import shutil
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
# command = ["pip", "install", "flet==0.23.2"]
|
7 |
+
|
8 |
+
# subprocess.run(command, check=True)
|
9 |
+
|
10 |
+
# command = ["pip", "install", "flet-fastapi==0.19.0", "--no-deps"]
|
11 |
+
|
12 |
+
# subprocess.run(command, check=True)
|
13 |
+
|
14 |
+
|
15 |
+
gh_token = os.getenv("gh_token")
|
16 |
+
|
17 |
+
url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/Allam_Dynamic.git"
|
18 |
+
|
19 |
+
os.system(f"git clone {url_with_token}")
|
20 |
+
|
21 |
+
time.sleep(10)
|
22 |
+
|
23 |
+
source_dir = "Allam_Dynamic"
|
24 |
+
destination_dir = "."
|
25 |
+
|
26 |
+
import os
|
27 |
+
|
28 |
+
# current_directory = os.getcwd()
|
29 |
+
|
30 |
+
# items = os.listdir(current_directory)
|
31 |
+
|
32 |
+
# for item in items:
|
33 |
+
# print(item)
|
34 |
+
|
35 |
+
for item in os.listdir(source_dir):
|
36 |
+
s = os.path.join(source_dir, item)
|
37 |
+
d = os.path.join(destination_dir, item)
|
38 |
+
shutil.move(s, d)
|
39 |
+
|
40 |
+
os.rmdir(source_dir)
|
41 |
+
|
42 |
+
with open("app.py", "r") as file:
|
43 |
+
code = file.read()
|
44 |
+
exec(code)
|
requirements.txt
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastapi==0.101.1
|
2 |
+
requests==2.31.0
|
3 |
+
flet==0.23.2
|
4 |
+
uvicorn==0.29.0
|
5 |
+
flet_core==0.23.2
|
6 |
+
supabase==2.7.4
|
7 |
+
pandas==2.1.4
|
8 |
+
openpyxl==3.1.2
|
9 |
+
azure-search-documents==11.4.0
|
10 |
+
openai==1.14.2
|
11 |
+
tiktoken==0.7.0
|
12 |
+
python-multipart==0.0.9
|
13 |
+
scipy==1.11.4
|
14 |
+
numpy==1.26.2
|
requirements_nodeps.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
flet-fastapi==0.19.0
|