Ahsen Khaliq commited on
Commit
903c7ca
1 Parent(s): 7b94e2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -12,13 +12,11 @@ model = AutoModelForCausalLM.from_pretrained("NovelAI/genji-python-6B").half().e
12
  import gradio as gr
13
 
14
  maxLength=400
15
- temperature=0.3
16
  top_k = 50
17
- top_p = 0.9
18
  repetition_penalty = 1.13
19
  repetition_penalty_range = 512
20
  repetition_penalty_slope = 3.33
21
- def generator(text):
22
  tokens = tokenizer(text, return_tensors="pt").input_ids.cuda()[:, -(2047-maxLength):]
23
  out = model.generate(
24
  tokens.long(),
@@ -43,11 +41,14 @@ article = "<p style='text-align: center'><a href='https://colab.research.google.
43
 
44
  gr.Interface(
45
  generator,
46
- gr.inputs.Textbox(label="input text", lines=5),
 
 
 
47
  gr.outputs.Textbox(label="Output text"),
48
  title=title,
49
  description=description,
50
  article=article,
51
  examples=[
52
- ['def print_customer_name']
53
  ]).launch(debug=True)
12
  import gradio as gr
13
 
14
  maxLength=400
 
15
  top_k = 50
 
16
  repetition_penalty = 1.13
17
  repetition_penalty_range = 512
18
  repetition_penalty_slope = 3.33
19
+ def generator(text, temperature,top_p):
20
  tokens = tokenizer(text, return_tensors="pt").input_ids.cuda()[:, -(2047-maxLength):]
21
  out = model.generate(
22
  tokens.long(),
41
 
42
  gr.Interface(
43
  generator,
44
+ [gr.inputs.Textbox(label="input text", lines=5),
45
+ gr.inputs.Slider(minimum=0, maximum=1, step=0.1, default=0.2, label="Temperature"),
46
+ gr.inputs.Slider(minimum=0, maximum=1, step=0.1, default=1, label="Top P")
47
+ ],
48
  gr.outputs.Textbox(label="Output text"),
49
  title=title,
50
  description=description,
51
  article=article,
52
  examples=[
53
+ ['def print_Hello_Huggingface():']
54
  ]).launch(debug=True)