# Help with a SimpleCSVLogger

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-a-simplecsvlogger%2F33551%3E%5C
**Category:** 🔒 Gradio\
**Created:** [March 11, 2023, 3:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-a-simplecsvlogger%2F33551 "2023-03-11T03:18:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![calculated-leap-vent](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@calculated-leap-vent](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcalculated-leap-vent)%5C
**Post date:** [March 11, 2023, 3:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-a-simplecsvlogger%2F33551%2F1 "2023-03-11T03:18:42Z")

</div>

I have been struggling to setup a SimpleCSVLogger demonstration all night! I seem to be missing [something really important in this demo here](https://huggingface.co/spaces/calculated-leap-ventures/Demonstrate-SimpleCSVLogger).

```auto
import gradio as gr

def ask(txt):
    print("Asked!")
    return "Fun", "Times"

desc = "Description"
article_text = "Article Text!"

with gr.Blocks(title=desc, 
               description=desc, 
               article=article_text,
               allow_flagging="manual",
               flagging_options=["Innacurate", "Off Topic"],
               flagging_dir="flags",
               flagging_callback=gr.SimpleCSVLogger(),
               analytics_enabled=True
               ) as demo:
    gr.Markdown(
    """
    # Maryland Kids Law!
    Start typing below to see the output.
    """)
    txt = gr.Textbox(label="Ask your question:", lines=5, placeholder="Is it ok to punch a kid?")
    txt_2 = gr.Textbox(value="Your Question will appear here.", label="Output", lines=5)
    txt_3 = gr.Textbox(value="The references cited to answer your question will appear here.", label="References", lines=5)
    btn = gr.Button(value="Ask!")
    btn.click(ask, inputs=txt, outputs=[txt_2, txt_3])
    gr.examples=[
        ["What a beautiful morning for a walk!"],
        ["It was the best of times, it was the worst of times."]
    ]
    gr.HTML("hello world!")
demo.launch()

```

First, it doesn’t show the flagging buttons specified.  
Second, it doesn’t seem to be logging anything.

When I run this same code locally, a folder “output” is created with jsons of each time it’s run.

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [March 17, 2023, 1:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-a-simplecsvlogger%2F33551%2F2 "2023-03-17T01:03:25Z")

</div>

hi @calculated-leap-vent

Here is how to use the CSVLogger with blocks, you can read more [here](https://gradio.app/using-flagging/#flagging-with-blocks)

```auto
import gradio as gr

def ask(txt):
    print("Asked!")
    return "Fun", "Times"

desc = "Description"
article_text = "Article Text!"

callback = gr.CSVLogger()

with gr.Blocks() as demo:
    gr.Markdown(
        """
    # Maryland Kids Law!
    Start typing below to see the output.
    """)
    txt = gr.Textbox(label="Ask your question:", lines=5,
                     placeholder="Is it ok to punch a kid?")
    txt_2 = gr.Textbox(placeholder="Your Question will appear here.",
                       label="Output", lines=5)
    txt_3 = gr.Textbox(
        placeholder="The references cited to answer your question will appear here.", label="References", lines=5)
    btn = gr.Button(value="Ask!")
    btn.click(ask, inputs=[txt], outputs=[txt_2, txt_3])

    gr.examples = [
        ["What a beautiful morning for a walk!"],
        ["It was the best of times, it was the worst of times."]
    ]
    gr.HTML("hello world!")

    callback.setup([txt, txt_2, txt_3], "flagged_data_points")
    # We can choose which components to flag -- in this case, we'll flag all of them
    btn.click(lambda *args: callback.flag(args),
              [txt, txt_2, txt_3], None, preprocess=False)

demo.launch()

```
