minify / app.py
kivilaid's picture
Update app.py
9a28ed0
Raw
History Blame
751 Bytes
import gradio as gr
# Function for the Minify interface
minify = gr.Interface(lambda name: "Hello " + name, "text", "text")
gr.File()
# Function for the Should we translate? interface
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")
# Creating a Tabbed Interface with updated tab names
demo = gr.TabbedInterface([minify, should_we_translate], ["Minify", "Should we translate?"])
if __name__ == "__main__":
demo.launch()