Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
words =
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
word = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for _ in range(word_length))
|
| 9 |
-
words.append(word)
|
| 10 |
-
return ' '.join(words)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
inputs=gr.inputs.Number(default=5, label='Number of words'),
|
| 15 |
-
outputs='text',
|
| 16 |
-
title='Random Word Generator',
|
| 17 |
-
description='Generate random words of length 5-10 characters.',
|
| 18 |
-
layout='vertical',
|
| 19 |
-
allow_flagging=False,
|
| 20 |
-
theme='default',
|
| 21 |
-
verbose=False,
|
| 22 |
-
)
|
| 23 |
|
|
|
|
| 24 |
interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
|
| 4 |
+
def generate_word(input_words):
|
| 5 |
+
words = input_words.split(",")
|
| 6 |
+
random_word = random.choice(words)
|
| 7 |
+
return random_word
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
input_box = gr.inputs.Textbox(label="Enter words separated by commas")
|
| 10 |
+
output_text = gr.outputs.Textbox(label="Random word")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
interface = gr.Interface(fn=generate_word, inputs=input_box, outputs=output_text, title="Random Word Generator")
|
| 13 |
interface.launch()
|