Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Commit 
							
							·
						
						c678872
	
1
								Parent(s):
							
							b4bb4ae
								
front changes
Browse files- app_dialogue.py +14 -10
- example_images/art_critic.png +0 -3
- example_images/baguettes_guarding_paris.png +0 -3
- example_images/bear_costume.png +0 -3
- example_images/blue_dog.png +0 -3
- example_images/can_horror.png +0 -3
- example_images/cat_sketch.png +0 -3
- example_images/chicken_on_money.png +0 -3
- example_images/concrete-eating-willsmith.jpg +0 -0
- example_images/dragons_playing.png +0 -3
- example_images/elon_smoking.jpg +0 -0
- example_images/gandhi_selfie.jpg +0 -0
- example_images/gaulois.png +0 -3
- example_images/ironman_cap.png +0 -3
- example_images/kanye.jpg +0 -0
- example_images/meme_french.jpg +0 -0
- example_images/obama-harry-potter.jpg +0 -0
- example_images/plant_bulb.webp +0 -0
- example_images/polar_bear_coke.png +0 -3
- example_images/pope_doudoune.webp +0 -0
- example_images/product_ad.jpg +0 -0
- example_images/rabbit_force.png +0 -3
- example_images/ramen.png +0 -3
- example_images/recipe_burger.webp +0 -0
- example_images/ryan-reynolds-borg.jpg +0 -0
- example_images/surfing_dog.jpg +0 -0
- example_images/tom-cruise-astronaut-pegasus.jpg +0 -0
- example_images/travel_tips.jpg +0 -0
- example_images/tree_fortress.jpg +0 -0
- example_images/zuck.jpeg +0 -0
    	
        app_dialogue.py
    CHANGED
    
    | @@ -60,7 +60,7 @@ BAN_TOKENS = (  # For documentation puporse. We are not using this list, it is h | |
| 60 | 
             
            EOS_STRINGS = ["<end_of_utterance>", "\nUser:"]
         | 
| 61 | 
             
            STOP_SUSPECT_LIST = []
         | 
| 62 |  | 
| 63 | 
            -
            GRADIO_LINK = "https://victorsanh- | 
| 64 | 
             
            API_TOKEN = os.getenv("HF_AUTH_TOKEN")
         | 
| 65 | 
             
            IDEFICS_LOGO = "https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/IDEFICS_logo.png"
         | 
| 66 |  | 
| @@ -109,7 +109,7 @@ DEFAULT_IMAGES_TMP_PATH_TO_URL = {} | |
| 109 | 
             
            for im_path in all_images:
         | 
| 110 | 
             
                H = gr.Image(im_path, visible=False, type="filepath")
         | 
| 111 | 
             
                tmp_filename = H.preprocess(H.value)
         | 
| 112 | 
            -
                DEFAULT_IMAGES_TMP_PATH_TO_URL[tmp_filename] = f"https://huggingface.co/spaces/HuggingFaceM4/ | 
| 113 |  | 
| 114 |  | 
| 115 | 
             
            # Utils to handle the image markdown display logic
         | 
| @@ -324,21 +324,21 @@ def format_user_prompt_with_im_history_and_system_conditioning( | |
| 324 | 
             
            # problematic_callback = gr.CSVLogger()
         | 
| 325 |  | 
| 326 | 
             
            textbox = gr.Textbox(
         | 
| 327 | 
            -
                placeholder="Upload an image and  | 
| 328 | 
             
                show_label=False,
         | 
| 329 | 
             
                # value="Write something funny about that image.",
         | 
| 330 | 
             
                visible=True,
         | 
| 331 | 
             
                container=False,
         | 
| 332 | 
             
                label="Text input",
         | 
| 333 | 
            -
                scale= | 
| 334 | 
             
                max_lines=5,
         | 
| 335 | 
             
            )
         | 
| 336 | 
             
            chatbot = gr.Chatbot(
         | 
| 337 | 
             
                elem_id="chatbot",
         | 
| 338 | 
            -
                label=" | 
| 339 | 
             
                visible=True,
         | 
| 340 | 
             
                height=750,
         | 
| 341 | 
            -
                avatar_images=[None, BOT_AVATAR] | 
| 342 | 
             
            )
         | 
| 343 |  | 
| 344 | 
             
            with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo:
         | 
| @@ -683,10 +683,6 @@ with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo: | |
| 683 | 
             
                            "Write a meme text for that image.",
         | 
| 684 | 
             
                            f"{examples_path}/example_images/citibike.webp",
         | 
| 685 | 
             
                        ],
         | 
| 686 | 
            -
                        [
         | 
| 687 | 
            -
                            "Write something funny about that. A meme for instance.",
         | 
| 688 | 
            -
                            f"{examples_path}/example_images/zuck.jpeg",
         | 
| 689 | 
            -
                        ],
         | 
| 690 | 
             
                        [
         | 
| 691 | 
             
                            "Craft a humorous caption for this image!",
         | 
| 692 | 
             
                            f"{examples_path}/example_images/echasse.jpg",
         | 
| @@ -730,5 +726,13 @@ with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo: | |
| 730 | 
             
                    ),
         | 
| 731 | 
             
                )
         | 
| 732 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 733 | 
             
            demo.queue(concurrency_count=40, max_size=40)
         | 
| 734 | 
             
            demo.launch()
         | 
|  | |
| 60 | 
             
            EOS_STRINGS = ["<end_of_utterance>", "\nUser:"]
         | 
| 61 | 
             
            STOP_SUSPECT_LIST = []
         | 
| 62 |  | 
| 63 | 
            +
            GRADIO_LINK = "https://victorsanh-ai-dad-jokes.hf.space"
         | 
| 64 | 
             
            API_TOKEN = os.getenv("HF_AUTH_TOKEN")
         | 
| 65 | 
             
            IDEFICS_LOGO = "https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/IDEFICS_logo.png"
         | 
| 66 |  | 
|  | |
| 109 | 
             
            for im_path in all_images:
         | 
| 110 | 
             
                H = gr.Image(im_path, visible=False, type="filepath")
         | 
| 111 | 
             
                tmp_filename = H.preprocess(H.value)
         | 
| 112 | 
            +
                DEFAULT_IMAGES_TMP_PATH_TO_URL[tmp_filename] = f"https://huggingface.co/spaces/HuggingFaceM4/ai_dad_jokes/resolve/main/example_images/{os.path.basename(im_path)}"
         | 
| 113 |  | 
| 114 |  | 
| 115 | 
             
            # Utils to handle the image markdown display logic
         | 
|  | |
| 324 | 
             
            # problematic_callback = gr.CSVLogger()
         | 
| 325 |  | 
| 326 | 
             
            textbox = gr.Textbox(
         | 
| 327 | 
            +
                placeholder="Upload an image and begin chatting with a message! Images can be added at each turn.",
         | 
| 328 | 
             
                show_label=False,
         | 
| 329 | 
             
                # value="Write something funny about that image.",
         | 
| 330 | 
             
                visible=True,
         | 
| 331 | 
             
                container=False,
         | 
| 332 | 
             
                label="Text input",
         | 
| 333 | 
            +
                scale=8,
         | 
| 334 | 
             
                max_lines=5,
         | 
| 335 | 
             
            )
         | 
| 336 | 
             
            chatbot = gr.Chatbot(
         | 
| 337 | 
             
                elem_id="chatbot",
         | 
| 338 | 
            +
                label="AI Dad Jokes",
         | 
| 339 | 
             
                visible=True,
         | 
| 340 | 
             
                height=750,
         | 
| 341 | 
            +
                avatar_images=[None, BOT_AVATAR]
         | 
| 342 | 
             
            )
         | 
| 343 |  | 
| 344 | 
             
            with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo:
         | 
|  | |
| 683 | 
             
                            "Write a meme text for that image.",
         | 
| 684 | 
             
                            f"{examples_path}/example_images/citibike.webp",
         | 
| 685 | 
             
                        ],
         | 
|  | |
|  | |
|  | |
|  | |
| 686 | 
             
                        [
         | 
| 687 | 
             
                            "Craft a humorous caption for this image!",
         | 
| 688 | 
             
                            f"{examples_path}/example_images/echasse.jpg",
         | 
|  | |
| 726 | 
             
                    ),
         | 
| 727 | 
             
                )
         | 
| 728 |  | 
| 729 | 
            +
                gr.HTML("""
         | 
| 730 | 
            +
                <div style="text-align: center; max-width: 650px; margin: 0 auto;">
         | 
| 731 | 
            +
                    <p>
         | 
| 732 | 
            +
                    Example images from <a href="https://www.instagram.com/whatisnewyork/">Whatisnewyork</a>.
         | 
| 733 | 
            +
                    </p>
         | 
| 734 | 
            +
                </div>
         | 
| 735 | 
            +
                """)
         | 
| 736 | 
            +
             | 
| 737 | 
             
            demo.queue(concurrency_count=40, max_size=40)
         | 
| 738 | 
             
            demo.launch()
         | 
    	
        example_images/art_critic.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/baguettes_guarding_paris.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/bear_costume.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/blue_dog.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/can_horror.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/cat_sketch.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/chicken_on_money.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/concrete-eating-willsmith.jpg
    DELETED
    
    | Binary file (79.7 kB) | 
|  | 
    	
        example_images/dragons_playing.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/elon_smoking.jpg
    DELETED
    
    | Binary file (57 kB) | 
|  | 
    	
        example_images/gandhi_selfie.jpg
    DELETED
    
    | Binary file (98.8 kB) | 
|  | 
    	
        example_images/gaulois.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/ironman_cap.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/kanye.jpg
    DELETED
    
    | Binary file (13.6 kB) | 
|  | 
    	
        example_images/meme_french.jpg
    DELETED
    
    | Binary file (70.7 kB) | 
|  | 
    	
        example_images/obama-harry-potter.jpg
    DELETED
    
    | Binary file (18.9 kB) | 
|  | 
    	
        example_images/plant_bulb.webp
    DELETED
    
    | Binary file (20.3 kB) | 
|  | 
    	
        example_images/polar_bear_coke.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/pope_doudoune.webp
    DELETED
    
    | Binary file (46.1 kB) | 
|  | 
    	
        example_images/product_ad.jpg
    DELETED
    
    | Binary file (82.6 kB) | 
|  | 
    	
        example_images/rabbit_force.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/ramen.png
    DELETED
    
    | Git LFS Details
 | 
    	
        example_images/recipe_burger.webp
    DELETED
    
    | Binary file (146 kB) | 
|  | 
    	
        example_images/ryan-reynolds-borg.jpg
    DELETED
    
    | Binary file (19.6 kB) | 
|  | 
    	
        example_images/surfing_dog.jpg
    DELETED
    
    | Binary file (283 kB) | 
|  | 
    	
        example_images/tom-cruise-astronaut-pegasus.jpg
    DELETED
    
    | Binary file (27.4 kB) | 
|  | 
    	
        example_images/travel_tips.jpg
    DELETED
    
    | Binary file (209 kB) | 
|  | 
    	
        example_images/tree_fortress.jpg
    DELETED
    
    | Binary file (154 kB) | 
|  | 
    	
        example_images/zuck.jpeg
    DELETED
    
    | Binary file (28.1 kB) | 
|  | 

