FoodDesert commited on
Commit
5e59db6
1 Parent(s): 8b24305

Upload app.py

Browse files

trying to directly reference the mascot image again.

Files changed (1) hide show
  1. app.py +1 -33
app.py CHANGED
@@ -718,39 +718,7 @@ with gr.Blocks(css=css) as app:
718
  #random_image_path = os.path.join('mascotimages', random.choice([f for f in os.listdir('mascotimages') if os.path.isfile(os.path.join('mascotimages', f))]))
719
  #with Image.open(random_image_path) as img:
720
  # gr.Image(value=img,show_label=False, show_download_button=False, show_share_button=False, height=200)
721
-
722
-
723
-
724
-
725
-
726
- try:
727
- files = [f for f in os.listdir('mascotimages') if os.path.isfile(os.path.join('mascotimages', f))]
728
- logging.debug(f"Mascot: Files in 'mascotimages': {files}") # Log the list of files found
729
-
730
- if files:
731
- random_image_path = os.path.join('mascotimages', random.choice(files))
732
- logging.info(f"Mascot: random_image_path: {random_image_path}") # Log which file was chosen
733
-
734
- # Open and display the image using Gradio
735
- try:
736
- with Image.open(random_image_path) as img:
737
- logging.debug(f"Mascot: Opened image: {random_image_path}") # Confirm image is opened
738
- gr.Image(value=img, show_label=False, show_download_button=False, show_share_button=False, height=200)
739
- except Exception as e:
740
- logging.error(f"Mascot: Failed to open or display the image: {e}") # Log if image fails to open or display
741
- else:
742
- logging.warning("Mascot: No files found in 'mascotimages' directory") # Log if no files are found
743
-
744
- except Exception as e:
745
- logging.error(f"Mascot: Error listing files in directory: {e}") # Log if there's an error listing the directory
746
-
747
-
748
-
749
-
750
-
751
-
752
-
753
-
754
  submit_button = gr.Button(variant="primary")
755
  with gr.Row():
756
  with gr.Column(scale=3):
 
718
  #random_image_path = os.path.join('mascotimages', random.choice([f for f in os.listdir('mascotimages') if os.path.isfile(os.path.join('mascotimages', f))]))
719
  #with Image.open(random_image_path) as img:
720
  # gr.Image(value=img,show_label=False, show_download_button=False, show_share_button=False, height=200)
721
+ gr.Image(value="https://huggingface.co/spaces/FoodDesert/Prompt_Squirrel/resolve/main/mascotimages/transparentsquirrel.png",show_label=False, show_download_button=False, show_share_button=False, height=200)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
  submit_button = gr.Button(variant="primary")
723
  with gr.Row():
724
  with gr.Column(scale=3):