HF Space: listen on PORT and add CPU torch+torchvision to requirements
Browse files- app_enhanced.py +12 -4
- requirements.txt +5 -0
app_enhanced.py
CHANGED
|
@@ -868,7 +868,7 @@ def upload_file():
|
|
| 868 |
f.save(comic_generator.video_path)
|
| 869 |
success = comic_generator.generate_comic()
|
| 870 |
if success:
|
| 871 |
-
webbrowser.open("http://localhost:
|
| 872 |
return "π Enhanced Comic Created Successfully!"
|
| 873 |
else:
|
| 874 |
return "β Comic generation failed"
|
|
@@ -887,7 +887,7 @@ def handle_link():
|
|
| 887 |
ydl.download([link])
|
| 888 |
success = comic_generator.generate_comic()
|
| 889 |
if success:
|
| 890 |
-
webbrowser.open("http://localhost:
|
| 891 |
return "π Enhanced Comic Created Successfully!"
|
| 892 |
else:
|
| 893 |
return "β Comic generation failed"
|
|
@@ -946,5 +946,13 @@ def frame_file(filename):
|
|
| 946 |
|
| 947 |
if __name__ == '__main__':
|
| 948 |
print("π Starting Enhanced Comic Generator...")
|
| 949 |
-
print("π Web interface available at: http://localhost:
|
| 950 |
-
app.run(debug=True, host='0.0.0.0', port=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 868 |
f.save(comic_generator.video_path)
|
| 869 |
success = comic_generator.generate_comic()
|
| 870 |
if success:
|
| 871 |
+
webbrowser.open("http://localhost:7860/comic")
|
| 872 |
return "π Enhanced Comic Created Successfully!"
|
| 873 |
else:
|
| 874 |
return "β Comic generation failed"
|
|
|
|
| 887 |
ydl.download([link])
|
| 888 |
success = comic_generator.generate_comic()
|
| 889 |
if success:
|
| 890 |
+
webbrowser.open("http://localhost:7860/comic")
|
| 891 |
return "π Enhanced Comic Created Successfully!"
|
| 892 |
else:
|
| 893 |
return "β Comic generation failed"
|
|
|
|
| 946 |
|
| 947 |
if __name__ == '__main__':
|
| 948 |
print("π Starting Enhanced Comic Generator...")
|
| 949 |
+
print("π Web interface available at: http://localhost:7860")
|
| 950 |
+
app.run(debug=True, host='0.0.0.0', port=7860)
|
| 951 |
+
|
| 952 |
+
|
| 953 |
+
if __name__ == "__main__":
|
| 954 |
+
import os
|
| 955 |
+
# Hugging Face Spaces provides the port in the PORT env var.
|
| 956 |
+
port = int(os.environ.get("PORT", 7860))
|
| 957 |
+
# listen on all interfaces so the container receives external traffic
|
| 958 |
+
app.run(host="0.0.0.0", port=port)
|
requirements.txt
CHANGED
|
@@ -10,3 +10,8 @@ Flask==3.0.3
|
|
| 10 |
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
| 11 |
torch==2.2.0+cpu
|
| 12 |
transformers==4.37.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
| 11 |
torch==2.2.0+cpu
|
| 12 |
transformers==4.37.2
|
| 13 |
+
|
| 14 |
+
# PyTorch CPU wheels (needed for torchvision)
|
| 15 |
+
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
| 16 |
+
torch==2.2.0+cpu
|
| 17 |
+
torchvision==0.17.0+cpu
|