File size: 1,701 Bytes
4b5bef1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
import gradio as gr
from transformers import pipeline

gbert_pipeline = pipeline("text-classification", model="LennardZuendorf/bert-base-german-cased", top_k=None, token="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")
leolm_pipeline = pipeline("text-classification", model="LennardZuendorf/interpretor", top_k=None, token="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")
chat_pipeline = pipeline("conversational", model="meta-llama/Llama-2-7b-chat-hf", top_k=None, token="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")

with gr.Blocks() as ui:
    with gr.Row():
        gr.Markdown(
            """
            # Thesis Model Demos
            Select between tabs below for try the different models.
            """)
    with gr.Tab("GBERT HateSpeech Detection"):
        with gr.Row():
            gr.Markdown(
                """
                ### GBERT (German Language BERT by Deepset) Demo
                #### Model finetuned on German Hate Speech dataset (~3,5k sequences)
                """)
        with gr.Row():
            gr.Interface.from_pipeline(gbert_pipeline)

    with gr.Tab("LeoLM HateSpeech Detection"):
        with gr.Row():
            gr.Markdown(
                """
                ### LeoLM (German Language FineTuned LlaMa2 Model) Demo
                #### Model finetuned on German Hate Speech dataset (~3,5k sequences)
                """)
        with gr.Row():
            gr.Button("New Tiger")

    with gr.Tab("Chat Model Interface"):
        with gr.Row():
            gr.Markdown(
                """
                ### LlaMa 2 Chat Demo
                """)
        with gr.Row():
            gr.Interface.from_pipeline(chat_pipeline)

if __name__ == "__main__":
    ui.launch()