Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def letter_counter(word, letter): | |
| """ | |
| ๋จ์ด ๋๋ ํ ์คํธ์์ ํน์ ๊ธ์๊ฐ ๋ช ๋ฒ ๋์ค๋์ง ์ธ์ด์ค๋๋ค. | |
| Args: | |
| word (str): ๊ฒ์ํ ํ ์คํธ๋ฅผ ์ ๋ ฅํ์ธ์. | |
| letter (str): ์ฐพ์ ๊ธ์๋ฅผ ์ ๋ ฅํ์ธ์. | |
| Returns: | |
| str: ํด๋น ๊ธ์๊ฐ ๋ช ๋ฒ ๋ํ๋ฌ๋์ง ์๋ ค์ฃผ๋ ๋ฉ์์ง. | |
| """ | |
| word = word.lower() | |
| letter = letter.lower() | |
| count = word.count(letter) | |
| return count | |
| demo = gr.Interface( | |
| fn=letter_counter, | |
| inputs=[gr.Textbox("strawberry"), gr.Textbox("r")], | |
| outputs=[gr.Number()], | |
| title="๊ธ์ ์ธ๊ธฐ ๋์ฐ๋ฏธ", | |
| description="ํ ์คํธ์ ์ฐพ๊ณ ์ถ์ ๊ธ์๋ฅผ ์ ๋ ฅํ๋ฉด ํด๋น ๊ธ์๊ฐ ๋ช ๋ฒ ๋ํ๋๋์ง ์ธ์ด๋๋ฆฝ๋๋ค." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch(mcp_server=True) |