LennardZuendorf commited on
Commit
4b5bef1
1 Parent(s): 354da81

inital app

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ gbert_pipeline = pipeline("text-classification", model="LennardZuendorf/bert-base-german-cased", top_k=None, token="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")
5
+ leolm_pipeline = pipeline("text-classification", model="LennardZuendorf/interpretor", top_k=None, token="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")
6
+ chat_pipeline = pipeline("conversational", model="meta-llama/Llama-2-7b-chat-hf", top_k=None, token="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")
7
+
8
+ with gr.Blocks() as ui:
9
+ with gr.Row():
10
+ gr.Markdown(
11
+ """
12
+ # Thesis Model Demos
13
+ Select between tabs below for try the different models.
14
+ """)
15
+ with gr.Tab("GBERT HateSpeech Detection"):
16
+ with gr.Row():
17
+ gr.Markdown(
18
+ """
19
+ ### GBERT (German Language BERT by Deepset) Demo
20
+ #### Model finetuned on German Hate Speech dataset (~3,5k sequences)
21
+ """)
22
+ with gr.Row():
23
+ gr.Interface.from_pipeline(gbert_pipeline)
24
+
25
+ with gr.Tab("LeoLM HateSpeech Detection"):
26
+ with gr.Row():
27
+ gr.Markdown(
28
+ """
29
+ ### LeoLM (German Language FineTuned LlaMa2 Model) Demo
30
+ #### Model finetuned on German Hate Speech dataset (~3,5k sequences)
31
+ """)
32
+ with gr.Row():
33
+ gr.Button("New Tiger")
34
+
35
+ with gr.Tab("Chat Model Interface"):
36
+ with gr.Row():
37
+ gr.Markdown(
38
+ """
39
+ ### LlaMa 2 Chat Demo
40
+ """)
41
+ with gr.Row():
42
+ gr.Interface.from_pipeline(chat_pipeline)
43
+
44
+ if __name__ == "__main__":
45
+ ui.launch()