TanU21 commited on
Commit
aafb916
·
verified ·
1 Parent(s): df003ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -8,19 +8,18 @@ load_dotenv()
8
 
9
  OLLAMA_BASE_URL = os.getenv("https://alpaca-upright-vulture.ngrok-free.app")
10
 
11
- llm = ChatOllama(model="llama3.2", base_url = OLLAMA_BASE_URL, temperature=0.5)
12
 
13
- #prompt = ChatPromptTemplate.from_template("Tell me a joke about a {subject}")
14
  prompt = ChatPromptTemplate.from_messages(
15
  [
16
- ("system","Generate a list of synonyms for the following word, only give 5 words and no extra messages."),
17
  ("human","{input}")
18
  ]
19
  )
20
 
21
  def synonyms(text):
22
- response = chain.invoke({"input":text})
23
- return response.content
24
 
25
  chain = prompt | llm
26
 
@@ -29,7 +28,7 @@ demo = gr.Interface(
29
  inputs = ["text"],
30
  outputs = ["text"],
31
  title = "Synonym Generator",
32
- description = "Generate a list of synonyms for the following word, only give 5 words with examples i.e use word in the sentences."
33
  )
34
 
35
  demo.launch()
 
8
 
9
  OLLAMA_BASE_URL = os.getenv("https://alpaca-upright-vulture.ngrok-free.app")
10
 
11
+ llm = ChatOllama(model="llama3", base_url = OLLAMA_BASE_URL, temperature=0.5)
12
 
 
13
  prompt = ChatPromptTemplate.from_messages(
14
  [
15
+ ("system","Generate a list of synonyms for the following word, only give 5 words with examples."),
16
  ("human","{input}")
17
  ]
18
  )
19
 
20
  def synonyms(text):
21
+ response = chain.invoke({"input": text})
22
+ return response.content
23
 
24
  chain = prompt | llm
25
 
 
28
  inputs = ["text"],
29
  outputs = ["text"],
30
  title = "Synonym Generator",
31
+ description = "Generate a list of synonyms for the following word"
32
  )
33
 
34
  demo.launch()