Thiloid commited on
Commit
9e2d2e2
·
verified ·
1 Parent(s): ce12c3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -167,7 +167,19 @@ def is_single_word_question(question):
167
  words = question.split()
168
  # Überprüfen, ob nur ein Wort vorhanden ist
169
  return len(words) == 1
170
-
 
 
 
 
 
 
 
 
 
 
 
 
171
  def responsefull(
172
  request: gr.Request,prompt, history,selected_option,temperature=0.9, max_new_tokens=700, top_p=0.95, repetition_penalty=1.0,
173
  ):
@@ -183,10 +195,10 @@ def responsefull(
183
  seed=42,
184
  )
185
  #get ID
186
- full_url = request.url
187
  IDval= get_value_after_question_mark(full_url)
188
  print(full_url)
189
- headers = request.headers
190
  IP, dev = extract_ip_and_device(headers)
191
 
192
  #if is_single_word_question(prompt)==1:
 
167
  words = question.split()
168
  # Überprüfen, ob nur ein Wort vorhanden ist
169
  return len(words) == 1
170
+ def get_value_after_question_mark(url):
171
+ url=str(url)
172
+ # Find the position of the question mark
173
+ question_mark_index = url.find('?')
174
+
175
+ # Extract the part after the question mark
176
+ if question_mark_index != -1:
177
+ value_after_question_mark = url[question_mark_index + 1:].split('=')[0]
178
+ else:
179
+ value_after_question_mark = ""
180
+
181
+ return value_after_question_mark
182
+
183
  def responsefull(
184
  request: gr.Request,prompt, history,selected_option,temperature=0.9, max_new_tokens=700, top_p=0.95, repetition_penalty=1.0,
185
  ):
 
195
  seed=42,
196
  )
197
  #get ID
198
+ full_url = gr.Request.url
199
  IDval= get_value_after_question_mark(full_url)
200
  print(full_url)
201
+ headers = gr.Request.headers
202
  IP, dev = extract_ip_and_device(headers)
203
 
204
  #if is_single_word_question(prompt)==1: