tts / app.py
3v324v23's picture
Add application file3
49cb8ba
raw
history blame
947 Bytes
import requests
import time
import threading
import gradio as gr
def get_public_ip():
response = requests.get('https://api.ipify.org?format=json')
return response.json()["ip"]
def simulate_interaction():
# *** Placeholder for simulating activity within a real application ***
print("Simulating interaction...") # Example action
def background_interaction():
"""Performs simulated interaction in a background thread"""
while True:
simulate_interaction()
time.sleep(60 * 5) # Simulate interaction every 5 minutes
# Gradio interface with public IP display
iface = gr.Interface(
fn=get_public_ip,
outputs="text",
title="Public IP Retriever",
description="Displays the approximate public IP address."
)
# Start background interaction thread
interaction_thread = threading.Thread(target=background_interaction)
interaction_thread.start()
# Launch the Gradio interface
iface.launch()