Spaces:
Paused
Paused
File size: 483 Bytes
41d98b6 b5d9a88 41d98b6 b5d9a88 9c7a74d 41d98b6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
import os
from loguru import logger
# Create a directory for logs if it doesn't exist
if not os.path.exists('logs'):
os.makedirs('logs')
# Define the log file path
log_file = 'logs/file_{time}.log'
# Configure the logger to write to the log file
logger.add(log_file, rotation="500 MB")
def greet(name):
logger.info("This is an info message")
return "Hi , " + name + "!!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()
|