birgermoell commited on
Commit
383ea2b
1 Parent(s): 64fd31c

Updated app

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -6,10 +6,10 @@ import torch
6
  # Loads Model and Pipeline #
7
  #===========================================#
8
 
9
- tokenizer = AutoTokenizer.from_pretrained("flax-community/swe-gpt-wiki")
10
- model = AutoModelWithLMHead.from_pretrained("flax-community/swe-gpt-wiki")
11
 
12
- generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
13
  # set_seed(42)
14
 
15
 
@@ -21,9 +21,20 @@ generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
21
  # "What language model would you like to try?",
22
  # ("Swedish", "Norwegian", "Danish", "Nordic"))
23
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- st.title('Svensk GPT text generering')
26
- desc = "En svensk GPT-modell tränad wikipedia. Fyll i text i fältet nedanför för generering."
27
 
28
  st.write(desc)
29
 
 
6
  # Loads Model and Pipeline #
7
  #===========================================#
8
 
9
+ # tokenizer = AutoTokenizer.from_pretrained("flax-community/swe-gpt-wiki")
10
+ # model = AutoModelWithLMHead.from_pretrained("flax-community/swe-gpt-wiki")
11
 
12
+ # generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
13
  # set_seed(42)
14
 
15
 
 
21
  # "What language model would you like to try?",
22
  # ("Swedish", "Norwegian", "Danish", "Nordic"))
23
 
24
+ gpt_models = ["birgermoell/swedish-gpt", "flax-community/swe-gpt-wiki", "flax-community/nordic-gpt-wiki", "flax-community/norsk-gpt-wiki", "flax-community/dansk-gpt-wiki"]
25
+
26
+ selected_model = st.selectbox(
27
+ "What language model would you like to try?",
28
+ (gpt_models))
29
+
30
+ tokenizer = AutoTokenizer.from_pretrained(selected_model)
31
+ model = AutoModelWithLMHead.from_pretrained(selected_model)
32
+
33
+ generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
34
+
35
 
36
+ st.title('GPT text generering')
37
+ desc = "Pröva GPT-modellerflera språk. Skriv text nedanför för att utvärdera. Använder " + selected_model + " för att generera text. " + "Här kan du läsa mer och modellen https://huggingface.co/" + selected_model
38
 
39
  st.write(desc)
40