Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Commit 
							
							Β·
						
						08251b4
	
1
								Parent(s):
							
							c0fdff8
								
init
Browse files- __pycache__/util.cpython-310.pyc +0 -0
 - app.py +29 -7
 
    	
        __pycache__/util.cpython-310.pyc
    ADDED
    
    | 
         Binary file (3.23 kB). View file 
     | 
| 
         | 
    	
        app.py
    CHANGED
    
    | 
         @@ -22,9 +22,31 @@ def generate_trump_voice_with_realtime_updates(text, word_num, request: gr.Reque 
     | 
|
| 22 | 
         
             
                IP_Dict[client_ip] += 1
         
     | 
| 23 | 
         
             
                print(f"client_ip: {client_ip}, count: {IP_Dict[client_ip]}")
         
     | 
| 24 | 
         
             
                if IP_Dict[client_ip] > 2:
         
     | 
| 25 | 
         
            -
                    msg = "You have reached the maximum number of requests 
     | 
| 26 | 
         
            -
                     
     | 
| 27 | 
         
            -
                     
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 28 | 
         | 
| 29 | 
         
             
                if not text or len(text.strip()) < 3:
         
     | 
| 30 | 
         
             
                    return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
         
     | 
| 
         @@ -174,16 +196,16 @@ with gr.Blocks(title="Donald Trump AI Voice", theme=gr.themes.Soft()) as demo: 
     | 
|
| 174 | 
         
             
                        placeholder="Waiting for generation..."
         
     | 
| 175 | 
         
             
                    )
         
     | 
| 176 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 177 | 
         
             
                with gr.Row():
         
     | 
| 178 | 
         
             
                    audio_output = gr.Audio(
         
     | 
| 179 | 
         
             
                        label="π΅ Trump AI Voice",
         
     | 
| 180 | 
         
             
                        interactive=False
         
     | 
| 181 | 
         
             
                    )
         
     | 
| 182 | 
         | 
| 183 | 
         
            -
                # Action buttons that will show after task completion
         
     | 
| 184 | 
         
            -
                with gr.Row():
         
     | 
| 185 | 
         
            -
                    action_links = gr.HTML(visible=False)
         
     | 
| 186 | 
         
            -
                
         
     | 
| 187 | 
         
             
                with gr.Row():
         
     | 
| 188 | 
         
             
                    task_info = gr.Textbox(
         
     | 
| 189 | 
         
             
                        label="π AI Rewritten Text with Latest News",
         
     | 
| 
         | 
|
| 22 | 
         
             
                IP_Dict[client_ip] += 1
         
     | 
| 23 | 
         
             
                print(f"client_ip: {client_ip}, count: {IP_Dict[client_ip]}")
         
     | 
| 24 | 
         
             
                if IP_Dict[client_ip] > 2:
         
     | 
| 25 | 
         
            +
                    msg = "You have reached the maximum number of requests"
         
     | 
| 26 | 
         
            +
                    # Create "Get More Tries" button HTML
         
     | 
| 27 | 
         
            +
                    get_more_tries_html = f"""
         
     | 
| 28 | 
         
            +
                    <div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
         
     | 
| 29 | 
         
            +
                        <a href='https://donaldtrumpaivoice.com/#generator' target='_blank' style='
         
     | 
| 30 | 
         
            +
                            display: inline-flex; 
         
     | 
| 31 | 
         
            +
                            align-items: center;
         
     | 
| 32 | 
         
            +
                            justify-content: center;
         
     | 
| 33 | 
         
            +
                            padding: 16px 32px; 
         
     | 
| 34 | 
         
            +
                            background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
         
     | 
| 35 | 
         
            +
                            color: white; 
         
     | 
| 36 | 
         
            +
                            text-decoration: none; 
         
     | 
| 37 | 
         
            +
                            border-radius: 12px; 
         
     | 
| 38 | 
         
            +
                            font-weight: 600;
         
     | 
| 39 | 
         
            +
                            font-size: 16px;
         
     | 
| 40 | 
         
            +
                            text-align: center;
         
     | 
| 41 | 
         
            +
                            min-width: 160px;
         
     | 
| 42 | 
         
            +
                            box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
         
     | 
| 43 | 
         
            +
                            transition: all 0.3s ease;
         
     | 
| 44 | 
         
            +
                            border: none;
         
     | 
| 45 | 
         
            +
                        '>π Get More Tries for Free</a>
         
     | 
| 46 | 
         
            +
                    </div>
         
     | 
| 47 | 
         
            +
                    """
         
     | 
| 48 | 
         
            +
                    yield msg, None, "", gr.update(value=get_more_tries_html, visible=True), ""
         
     | 
| 49 | 
         
            +
                    return msg, None, "", gr.update(value=get_more_tries_html, visible=True), ""
         
     | 
| 50 | 
         | 
| 51 | 
         
             
                if not text or len(text.strip()) < 3:
         
     | 
| 52 | 
         
             
                    return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
         
     | 
| 
         | 
|
| 196 | 
         
             
                        placeholder="Waiting for generation..."
         
     | 
| 197 | 
         
             
                    )
         
     | 
| 198 | 
         | 
| 199 | 
         
            +
                # Action buttons that will show after task completion
         
     | 
| 200 | 
         
            +
                with gr.Row():
         
     | 
| 201 | 
         
            +
                    action_links = gr.HTML(visible=False)
         
     | 
| 202 | 
         
            +
                
         
     | 
| 203 | 
         
             
                with gr.Row():
         
     | 
| 204 | 
         
             
                    audio_output = gr.Audio(
         
     | 
| 205 | 
         
             
                        label="π΅ Trump AI Voice",
         
     | 
| 206 | 
         
             
                        interactive=False
         
     | 
| 207 | 
         
             
                    )
         
     | 
| 208 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 209 | 
         
             
                with gr.Row():
         
     | 
| 210 | 
         
             
                    task_info = gr.Textbox(
         
     | 
| 211 | 
         
             
                        label="π AI Rewritten Text with Latest News",
         
     |