Krzysztof Krystian Jankowski commited on
Commit
66f7310
1 Parent(s): 5b8c66e
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -5,7 +5,9 @@ from langchain_community.llms import CTransformers
5
  model="TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF"
6
  config = {'max_new_tokens': 128,
7
  'repetition_penalty': 1.1,
8
- 'temperature':0.6}
 
 
9
 
10
  def getLlamaResponse(input_text, no_words, blog_style):
11
  llm=CTransformers(model=model,
@@ -15,9 +17,9 @@ def getLlamaResponse(input_text, no_words, blog_style):
15
  # create a prompt
16
 
17
  template="""
18
- You are a ghost writer for writing posts for a weblog.
19
- Write a blog post about the topic: {input_text} in {blog_style} style.
20
- The blog should be {no_words} words long.
21
  """
22
  prompt=PromptTemplate(input_variables=["blog_style", "input_text", "no_words"],
23
  template=template)
@@ -38,7 +40,7 @@ col1, col2 = st.columns([5, 5])
38
  with col1:
39
  no_words=st.text_input("Enter the number of words", value=100)
40
  with col2:
41
- blog_style=st.selectbox("Select the Blog Style", ["Personal", "Research", "Story Driven"])
42
  submit=st.button("Generate Blog")
43
  if submit:
44
  st.write(getLlamaResponse(input_text, no_words, blog_style))
 
5
  model="TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF"
6
  config = {'max_new_tokens': 128,
7
  'repetition_penalty': 1.1,
8
+ 'temperature':0.4,
9
+ 'top_k':50,
10
+ 'top_p':0.9}
11
 
12
  def getLlamaResponse(input_text, no_words, blog_style):
13
  llm=CTransformers(model=model,
 
17
  # create a prompt
18
 
19
  template="""
20
+ You are a ghost writer helping writing posts for a weblog. Do not provide any instructions just write the post.
21
+ The post should be {no_words} words long.
22
+ Write a blog post about the topic: {input_text} in {blog_style} style.
23
  """
24
  prompt=PromptTemplate(input_variables=["blog_style", "input_text", "no_words"],
25
  template=template)
 
40
  with col1:
41
  no_words=st.text_input("Enter the number of words", value=100)
42
  with col2:
43
+ blog_style=st.selectbox("Select the Blog Style", ["Personal", "Research Paper", "Humor, casual"])
44
  submit=st.button("Generate Blog")
45
  if submit:
46
  st.write(getLlamaResponse(input_text, no_words, blog_style))