Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -286,11 +286,11 @@ def generate(text, history, rag_option, model_option, temperature=0.5, max_new_
|
|
286 |
#payload = tokenizer.apply_chat_template(prompt,tokenize=False)
|
287 |
#result = client.text_generation(payload, do_sample=True,return_full_text=False, max_new_tokens=2048,top_p=0.9,temperature=0.6,)
|
288 |
#inference allg:
|
289 |
-
result= requests.post(API_URL, headers=HEADERS, json={"inputs":
|
290 |
print("prompt:..................")
|
291 |
print(prompt)
|
292 |
print("result:..................")
|
293 |
-
print(result)
|
294 |
except Exception as e:
|
295 |
raise gr.Error(e)
|
296 |
|
@@ -306,12 +306,12 @@ def generate(text, history, rag_option, model_option, temperature=0.5, max_new_
|
|
306 |
|
307 |
#zum Evaluieren:
|
308 |
# custom eli5 criteria
|
309 |
-
custom_criterion = {"eli5": "Is the output explained in a way that a 5 yeard old would unterstand it?"}
|
310 |
|
311 |
-
eval_result = evaluator.evaluate_strings(prediction=res.strip(), input=text, criteria=custom_criterion, requires_reference=True)
|
312 |
-
print ("eval_result:............ ")
|
313 |
-
print(eval_result)
|
314 |
-
return res.strip()
|
315 |
|
316 |
########################################
|
317 |
#Evaluation
|
|
|
286 |
#payload = tokenizer.apply_chat_template(prompt,tokenize=False)
|
287 |
#result = client.text_generation(payload, do_sample=True,return_full_text=False, max_new_tokens=2048,top_p=0.9,temperature=0.6,)
|
288 |
#inference allg:
|
289 |
+
result= requests.post(API_URL, headers=HEADERS, json={"inputs": prompt})
|
290 |
print("prompt:..................")
|
291 |
print(prompt)
|
292 |
print("result:..................")
|
293 |
+
print(result.json())
|
294 |
except Exception as e:
|
295 |
raise gr.Error(e)
|
296 |
|
|
|
306 |
|
307 |
#zum Evaluieren:
|
308 |
# custom eli5 criteria
|
309 |
+
#custom_criterion = {"eli5": "Is the output explained in a way that a 5 yeard old would unterstand it?"}
|
310 |
|
311 |
+
#eval_result = evaluator.evaluate_strings(prediction=res.strip(), input=text, criteria=custom_criterion, requires_reference=True)
|
312 |
+
#print ("eval_result:............ ")
|
313 |
+
#print(eval_result)
|
314 |
+
#return res.strip()
|
315 |
|
316 |
########################################
|
317 |
#Evaluation
|