File size: 957 Bytes
7a8b33f
 
 
 
 
 
 
 
cbe0c63
7a8b33f
 
 
 
 
ead1c57
7a8b33f
 
 
 
0dd49e9
bcad772
 
0dd49e9
7a8b33f
a7fd27d
7a8b33f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# gradio_app.py

import gradio as gr
from run_pipeline import get_fact_checked


def fact_check_function(text, model):
    # Assume the text is already read from the user input, so we don't need to open a file here
    out = get_fact_checked(text, mode="fast", model=model)
    return out["fact_checked_md"]


def create_gradio_interface():
    iface = gr.Interface(
        title="Filtir - Fact-Checking AI generated content",
        allow_flagging=False,
        fn=fact_check_function,
        inputs=[
            gr.Textbox(
                lines=6,
                placeholder="Enter text to fact-check...",
                label="Input Text",
                max_lines=10,
            ),
            gr.Dropdown(choices=["gpt-3.5-turbo", "gpt-4-1106-preview"], label="Model"),
        ],
        outputs=gr.Markdown(label="Filtir Output"),
    )
    return iface


if __name__ == "__main__":
    iface = create_gradio_interface()
    iface.launch()