testapi / app.py
Taf2023's picture
Update app.py
a040b91 verified
raw
history blame
642 Bytes
import random
import gradio as gr
import subprocess
def randomize_words():
words = ['apple', 'banana', 'orange', 'grape', 'pear']
random.shuffle(words)
randomized_words = ' '.join(words)
return randomized_words
iface = gr.Interface(fn=randomize_words,
inputs=None,
outputs="text",
title='Random Word API',
description='Click "Generate" to get a random order of words.')
# Launch the Gradio interface
iface.launch(share=False)
# Set up Ngrok tunnel to create a public URL
ngrok_process = subprocess.Popen(['ngrok', 'http', '7860'])