File size: 1,324 Bytes
49cb8ba
 
 
 
6f44266
 
 
 
49cb8ba
 
 
 
 
 
6f44266
 
 
 
 
 
49cb8ba
 
6f44266
49cb8ba
 
6f44266
49cb8ba
6f44266
49cb8ba
6f44266
bd07181
 
6f44266
 
49cb8ba
 
bd07181
6f44266
49cb8ba
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import time
import threading
import gradio as gr
from transformers import pipeline

# Load Whisper model (adjust size as needed)
model = pipeline("automatic-speech-recognition", model="openai/whisper-base")

def get_public_ip():
    response = requests.get('https://api.ipify.org?format=json')
    return response.json()["ip"]

def simulate_interaction():
    # *** Placeholder for simulating activity ***   
    print("Simulating interaction...") 

def transcribe_audio(audio):
    transcription = model(audio)["text"]
    return transcription

def background_interaction():
    """Placeholder for background interaction"""
    while True:
        simulate_interaction()
        time.sleep(60 * 5)  

# Gradio interface with IP display and speech-to-text
iface = gr.Interface(
    [get_public_ip, transcribe_audio], 
    [gr.Textbox(lines=1, placeholder="Public IP will appear here"), gr.Audio(source="microphone", type="filepath")], 
    [gr.Textbox(), gr.Textbox()],
    title="Public IP Retriever & Whisper Transcription",
    description="Get your approximate public IP and transcribe audio using Whisper."
)


# Start background interaction thread (optional)
interaction_thread = threading.Thread(target=background_interaction)
interaction_thread.start()

# Launch the Gradio interface
iface.launch()