Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -307,22 +307,22 @@ def create_hf_space():
|
|
307 |
# Special handling for Docker Spaces
|
308 |
if space_type == "docker" and "Dockerfile" not in files:
|
309 |
default_dockerfile = """
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
os.remove("temp_Dockerfile")
|
327 |
space_url = f"https://huggingface.co/spaces/{full_repo_id}"
|
328 |
return jsonify({
|
|
|
307 |
# Special handling for Docker Spaces
|
308 |
if space_type == "docker" and "Dockerfile" not in files:
|
309 |
default_dockerfile = """
|
310 |
+
FROM python:3.10-slim
|
311 |
+
WORKDIR /app
|
312 |
+
COPY . .
|
313 |
+
RUN pip install -r requirements.txt
|
314 |
+
EXPOSE 7860
|
315 |
+
CMD ["python", "app.py"]
|
316 |
+
"""
|
317 |
+
with open("temp_Dockerfile", "w") as f:
|
318 |
+
f.write(default_dockerfile)
|
319 |
+
upload_file(
|
320 |
+
path_or_fileobj="temp_Dockerfile",
|
321 |
+
path_in_repo="Dockerfile",
|
322 |
+
repo_id=full_repo_id,
|
323 |
+
repo_type="space",
|
324 |
+
token=HF_TOKEN
|
325 |
+
)
|
326 |
os.remove("temp_Dockerfile")
|
327 |
space_url = f"https://huggingface.co/spaces/{full_repo_id}"
|
328 |
return jsonify({
|