mgokg commited on
Commit
1a882eb
·
verified ·
1 Parent(s): 9f6ca43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -42,6 +42,19 @@ def selenium(message):
42
  wd.get(url)
43
  time.sleep(1)
44
  element = wd.find_element(By.TAG_NAME, "body")
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  return element.text
46
  #text_input = wd.find_element(By.XPATH, '/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[2]/div/div/div[1]/textarea')
47
 
 
42
  wd.get(url)
43
  time.sleep(1)
44
  element = wd.find_element(By.TAG_NAME, "body")
45
+
46
+ try:
47
+ completion = client.chat.completions.create(
48
+ model="llama3-70b-8192",
49
+ messages=[
50
+ {"role": "system", "content": "You are a helpful assistant."},
51
+ {"role": "user", "content": f"return json object with keys name and email. \n name = {message}\n value for email can be found here: {element.text} \n \n"}
52
+ ],
53
+ )
54
+ return completion.choices[0].message.content
55
+ except Exception as e:
56
+ return f"Error in response generation: {str(e)}"
57
+
58
  return element.text
59
  #text_input = wd.find_element(By.XPATH, '/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[2]/div/div/div[1]/textarea')
60