Daniel-IADAR commited on
Commit
dc5e638
·
verified ·
1 Parent(s): 289dae1

Upload folder using huggingface_hub

Browse files
__pycache__/gradio_demo.cpython-39.pyc CHANGED
Binary files a/__pycache__/gradio_demo.cpython-39.pyc and b/__pycache__/gradio_demo.cpython-39.pyc differ
 
gradio_demo.py CHANGED
@@ -255,15 +255,15 @@ def preview_media(media_file):
255
  def handle_image_upload(image_file):
256
  """Handle image upload and show it."""
257
  if image_file is None:
258
- return None, gr.update(visible=False)
259
- return image_file, gr.update(visible=False)
260
 
261
 
262
  def handle_video_upload(video_file):
263
  """Handle video upload and show it."""
264
  if video_file is None:
265
- return gr.update(visible=True), None
266
- return gr.update(visible=False), video_file
267
 
268
 
269
  def process_media(image_file, video_file):
@@ -427,9 +427,13 @@ if __name__ == "__main__":
427
  # Check if running on Hugging Face Spaces or Modal
428
  if os.getenv("SPACE_ID") or os.getenv("SYSTEM") == "spaces":
429
  # Running on Hugging Face Spaces
430
- demo.launch()
 
 
 
 
431
  elif os.getenv("MODAL_ENVIRONMENT"):
432
- # Running on Modal - just launch on the expected port
433
  demo.launch(
434
  server_name="0.0.0.0",
435
  server_port=8080,
 
255
  def handle_image_upload(image_file):
256
  """Handle image upload and show it."""
257
  if image_file is None:
258
+ return gr.update(value=None, visible=True), gr.update(visible=False)
259
+ return gr.update(value=image_file, visible=True), gr.update(visible=False)
260
 
261
 
262
  def handle_video_upload(video_file):
263
  """Handle video upload and show it."""
264
  if video_file is None:
265
+ return gr.update(visible=True), gr.update(value=None, visible=False)
266
+ return gr.update(visible=False), gr.update(value=video_file, visible=True)
267
 
268
 
269
  def process_media(image_file, video_file):
 
427
  # Check if running on Hugging Face Spaces or Modal
428
  if os.getenv("SPACE_ID") or os.getenv("SYSTEM") == "spaces":
429
  # Running on Hugging Face Spaces
430
+ demo.launch(
431
+ server_name="0.0.0.0",
432
+ server_port=7860,
433
+ share=False
434
+ )
435
  elif os.getenv("MODAL_ENVIRONMENT"):
436
+ # Running on Modal
437
  demo.launch(
438
  server_name="0.0.0.0",
439
  server_port=8080,
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  gradio==4.44.1
 
2
  modal>=0.60.0
3
  pandas>=2.0.0
4
  requests>=2.31.0
@@ -6,4 +7,4 @@ mysql-connector-python>=8.0.0
6
  json-repair>=0.25.0
7
  boto3>=1.28.0
8
  python-dotenv>=1.0.0
9
- huggingface_hub>=0.20.0,<0.26.0
 
1
  gradio==4.44.1
2
+ gradio-client==1.4.2
3
  modal>=0.60.0
4
  pandas>=2.0.0
5
  requests>=2.31.0
 
7
  json-repair>=0.25.0
8
  boto3>=1.28.0
9
  python-dotenv>=1.0.0
10
+ huggingface_hub==0.25.2