| import gradio as gr |
|
|
| |
| def generate_text(input_text, checkbox_option, file_upload, slider_value): |
| result = f"Input Text: {input_text}\nCheckbox Option: {checkbox_option}\nSlider Value: {slider_value}" |
|
|
| |
| if file_upload is not None: |
| result += f"\nUploaded File Content: {file_upload.read().decode('utf-8')}" |
|
|
| return result |
|
|
| |
| iface = gr.Interface( |
| fn=generate_text, |
| inputs=[ |
| gr.Textbox("Введите текст"), |
| gr.Checkbox("Включить опцию"), |
| gr.File("Загрузить файл"), |
| gr.Slider(minimum=0, maximum=10, default=5, label="Выберите значение слайдера"), |
| ], |
| outputs=gr.Textbox("Результат"), |
| live=True |
| ) |
|
|
| |
| iface.launch() |
|
|