Spaces:
Runtime error
Runtime error
Srinivasulu kethanaboina commited on
Update app.py
Browse files123456789101112131415161718import gradio as grimport ip_address as ipimport requestsdef get_client_ip():response = requests.get('https://api.ipify.org?format=json')return response.json().get('ip', 'Unable to fetch IP address')def get_ip_html():address = ip.get()return get_client_ip()with gr.Blocks() as demo:gr.HTML(get_ip_html)demo.launch()1234567891011121314151617181920from flask import Flask, requestimport gradio as grapp = Flask(__name__)def get_ip():# Retrieve the client's IP addressclient_ip = request.remote_addrreturn f"Client IP Address: {client_ip}"# Define the Gradio interfaceinterface = gr.Interface(fn=get_ip, inputs=[], outputs="text")@app.route('/')def index():# Launch Gradio interface on the Flask routereturn interface.launch(share=True)if __name__ == '__main__':app.run(debug=True)
app.py+14-12