davda54 commited on
Commit
10dbfbb
·
1 Parent(s): 6aa0b7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import torch
2
- from transformers import AutoTokenizer, TextIteratorStreamer
3
- # from modeling_nort5 import NorT5ForConditionalGeneration
4
  from threading import Thread
 
5
 
6
 
7
  print(f"Starting to load the model to memory")
@@ -25,14 +25,6 @@ model.eval()
25
  print(f"Sucessfully loaded the model to the memory")
26
 
27
 
28
- INITIAL_PROMPT = "Du er NorT5, en språkmodell laget ved Universitetet i Oslo. Du er en hjelpsom og ufarlig assistent som er glade for å hjelpe brukeren med enhver forespørsel."
29
- TEMPERATURE = 0.7
30
- SAMPLE = True
31
- BEAMS = 1
32
- PENALTY = 1.2
33
- TOP_K = 64
34
- TOP_P = 0.95
35
-
36
  LANGUAGES = [
37
  "🇬🇧 English",
38
  "🇳🇴 Norwegian (Bokmål)",
@@ -71,15 +63,9 @@ def switch_inputs(source, target, source_language, target_language):
71
  return target, source, target_language, source_language
72
 
73
 
74
- import gradio as gr
75
-
76
  with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
77
 
78
  gr.Markdown("# Norwegian-English translation")
79
- # gr.HTML('<img src="https://huggingface.co/ltg/norbert3-base/resolve/main/norbert.png" width=6.75%>')
80
- # gr.Checkbox(label="I want to publish all my conversations", value=True)
81
-
82
- # chatbot = gr.Chatbot(value=[[None, "Hei, hva kan jeg gjøre for deg? 😊"]])
83
 
84
  with gr.Row():
85
  with gr.Column(scale=7, variant="panel"):
 
1
  import torch
2
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, TextIteratorStreamer
 
3
  from threading import Thread
4
+ import gradio as gr
5
 
6
 
7
  print(f"Starting to load the model to memory")
 
25
  print(f"Sucessfully loaded the model to the memory")
26
 
27
 
 
 
 
 
 
 
 
 
28
  LANGUAGES = [
29
  "🇬🇧 English",
30
  "🇳🇴 Norwegian (Bokmål)",
 
63
  return target, source, target_language, source_language
64
 
65
 
 
 
66
  with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
67
 
68
  gr.Markdown("# Norwegian-English translation")
 
 
 
 
69
 
70
  with gr.Row():
71
  with gr.Column(scale=7, variant="panel"):