Dooratre commited on
Commit
09af5d0
·
verified ·
1 Parent(s): 84d795b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -9
app.py CHANGED
@@ -11,6 +11,7 @@ from nltk.stem import PorterStemmer
11
  from nltk.stem import WordNetLemmatizer
12
  import spacy
13
  from bs4 import BeautifulSoup
 
14
 
15
  # Download NLTK resources
16
  nltk.download('punkt')
@@ -41,16 +42,7 @@ prompt = PromptTemplate(template=template, input_variables=["message", "sentimen
41
  conversation_history = []
42
 
43
  MAX_HISTORY_LENGTH = 55
44
- url = "https://dooratre-info.hf.space/?logs=container&__sign=eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2NWIyYzMyNjJiZTk2NjBmMGIxMjg0MDAiLCJ1c2VyIjoiRG9vcmF0cmUifSwiaWF0IjoxNzEyNjgwNTY4LCJzdWIiOiIvc3BhY2VzL0Rvb3JhdHJlL2luZm8iLCJleHAiOjE3MTI3NjY5NjgsImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.R_PX6Hw5SMheYTQWPGe1Qla9q8gVBU0mAFF_u8Iad06jSpZ9sPzZqquSowWn7PGVLRYBW21DnvqSwXIoNZ4CAA"
45
-
46
- response = requests.get(url)
47
- soup = BeautifulSoup(response.content, 'html.parser')
48
 
49
- div_content = soup.find('div', {'id': '45'})
50
- if div_content:
51
- print(div_content)
52
- else:
53
- print("No div with id=45 found on the page.")
54
 
55
  def update_conversation_history(message):
56
  if len(conversation_history) >= MAX_HISTORY_LENGTH:
@@ -70,6 +62,27 @@ def get_bitcoin_price():
70
  else:
71
  return 'Error fetching data', current_time
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  @app.route('/assets/<path:path>')
74
  def send_static(path):
75
  return send_from_directory('assets', path)
 
11
  from nltk.stem import WordNetLemmatizer
12
  import spacy
13
  from bs4 import BeautifulSoup
14
+ import time
15
 
16
  # Download NLTK resources
17
  nltk.download('punkt')
 
42
  conversation_history = []
43
 
44
  MAX_HISTORY_LENGTH = 55
 
 
 
 
45
 
 
 
 
 
 
46
 
47
  def update_conversation_history(message):
48
  if len(conversation_history) >= MAX_HISTORY_LENGTH:
 
62
  else:
63
  return 'Error fetching data', current_time
64
 
65
+
66
+
67
+
68
+ def get_div_content(url):
69
+ response = requests.get(url)
70
+ soup = BeautifulSoup(response.content, 'html.parser')
71
+
72
+ div_content = soup.find('div', {'id': '45'})
73
+ if div_content:
74
+ return div_content
75
+ else:
76
+ return "No div with id=45 found on the page."
77
+
78
+ url = "https://dooratre-info.hf.space/?logs=container&__sign=eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2NWIyYzMyNjJiZTk2NjBmMGIxMjg0MDAiLCJ1c2VyIjoiRG9vcmF0cmUifSwiaWF0IjoxNzEyNjgwNTY4LCJzdWIiOiIvc3BhY2VzL0Rvb3JhdHJlL2luZm8iLCJleHAiOjE3MTI3NjY5NjgsImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.R_PX6Hw5SMheYTQWPGe1Qla9q8gVBU0mAFF_u8Iad06jSpZ9sPzZqquSowWn7PGVLRYBW21DnvqSwXIoNZ4CAA"
79
+
80
+ while True:
81
+ result = get_div_content(url)
82
+ print(result)
83
+ time.sleep(5) # Wait for 5 seconds before checking again
84
+
85
+
86
  @app.route('/assets/<path:path>')
87
  def send_static(path):
88
  return send_from_directory('assets', path)