import gradio as gr import threading import requests import time def send_dummy_request(space_url): try: response = requests.get(space_url) # Print the response status code (optional) print(f"Response Status Code Of Wait: {response.status_code}") except Exception as e: print(f"Error: {e}") def background_request(space_urls, interval_seconds): try: while True: for space_url in space_urls: send_dummy_request(space_url) time.sleep(interval_seconds) except KeyboardInterrupt: print("Background script terminated by user.") space_urls = [ # For Spaces 'https://huggingface.co/spaces/clone3/Wait', 'https://huggingface.co/spaces/clone3/NewSpace', # For Self ] # Set the interval for sending requests (in seconds) interval_seconds = 7200 # 2 hours # Start the background thread background_thread = threading.Thread(target=background_request, args=(space_urls, interval_seconds)) background_thread.start() # Gradio interface def echo_text(text): return f"You said: {text}" iface = gr.Interface(fn=echo_text, inputs="text", outputs="text") iface.launch()