mgokg commited on
Commit
95503e4
·
verified ·
1 Parent(s): e8224c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -58,8 +58,20 @@ def google_search(payloads):
58
  texte +=o
59
  return output
60
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  def llm(message):
62
- message = f"return a json object with the keys: name,email,phone,website \n the values can be found here, leave blank if value is not available:\n {message} \n return a json object only. no text, no explanaition"
63
  try:
64
  completion = client.chat.completions.create(
65
  model="llama3-70b-8192",
@@ -127,10 +139,10 @@ def process_ort(ort):
127
  for verein in links_text:
128
  prompt=f"kontaktdaten {verein}",
129
  result = perplexica_search(prompt)
130
- print(result)
131
- #json_data = llm(result)
132
- #vereine.append(json_data)
133
- vereine.append(result)
134
 
135
  return vereine
136
 
 
58
  texte +=o
59
  return output
60
 
61
+ scheme = """
62
+ {"name":"","email":"","website":""}
63
+ """
64
+
65
+ def llama(message):
66
+ client = Client("AiActivity/AI-Assistant")
67
+ result = client.predict(
68
+ message={"text":f"instruction: return a valid json object only, no comments or explanaition, fill in the missing information. use this json scheme.\n {scheme}\n leave blank if information is not verfügbar. here is the information for the values:\n{message}","files":[]},
69
+ api_name="/chat"
70
+ )
71
+ print(result)
72
+
73
  def llm(message):
74
+ message = f'return a json object with the keys: name,email,phone,website \n the values can be found here, leave blank if value is not available:\n {message} \n return a json object only. no text, no explanaition'
75
  try:
76
  completion = client.chat.completions.create(
77
  model="llama3-70b-8192",
 
139
  for verein in links_text:
140
  prompt=f"kontaktdaten {verein}",
141
  result = perplexica_search(prompt)
142
+ #print(result)
143
+ json_data = llama(result)
144
+ vereine.append(json_data)
145
+ #vereine.append(result)
146
 
147
  return vereine
148