Spaces:
tester343
/
Configuration error

3v324v23 commited on
Commit
80425a1
Β·
1 Parent(s): 52f913c

HF Space: listen on PORT and add CPU torch+torchvision to requirements

Browse files
Files changed (2) hide show
  1. app_enhanced.py +12 -4
  2. 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:5000/comic")
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:5000/comic")
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:5000")
950
- app.run(debug=True, host='0.0.0.0', port=5000)
 
 
 
 
 
 
 
 
 
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