| import gradio as gr |
|
|
| |
| minify = gr.Interface(lambda name: "Hello " + name, "text", "text") |
| gr.File() |
|
|
| |
| def check_input(input_string): |
| if not input_string.strip(): |
| return "No words in the input." |
| words = input_string.split() |
| response = [f"'{word}' is a valid word." if word.isalpha() and ' ' not in word else f"'{word}' is not a valid word." for word in words] |
| return " ".join(response) |
|
|
| should_we_translate = gr.Interface(check_input, "text", "text") |
|
|
| |
| demo = gr.TabbedInterface([minify, should_we_translate], ["Minify", "Should we translate?"]) |
|
|
| if __name__ == "__main__": |
| demo.launch() |
|
|