Spaces:
Running
Running
Commit
•
0fef086
1
Parent(s):
a5ef5d4
updated logs
Browse filesnow it will show how much attempts spent on generate answers
- gradio_app.py +4 -0
gradio_app.py
CHANGED
@@ -68,11 +68,15 @@ def generate_answer(request: str, max_tokens: int = 256, language: str = "en", c
|
|
68 |
|
69 |
try:
|
70 |
# this shitty fix will be until i willnt figure out why sometimes there is empty output
|
|
|
71 |
while True:
|
|
|
72 |
output = llm(userPrompt, max_tokens=maxTokens, stop=["User:"], echo=False)
|
73 |
text = output["choices"][0]["text"]
|
74 |
if len(text.strip()) > 1 and text.strip() not in ['', None, ' ']:
|
75 |
break
|
|
|
|
|
76 |
|
77 |
if language in languages:
|
78 |
logs += f"\nTranslating from en to {language}"
|
|
|
68 |
|
69 |
try:
|
70 |
# this shitty fix will be until i willnt figure out why sometimes there is empty output
|
71 |
+
counter = 1
|
72 |
while True:
|
73 |
+
logs += f"Attempt {counter} to generate answer...\n"
|
74 |
output = llm(userPrompt, max_tokens=maxTokens, stop=["User:"], echo=False)
|
75 |
text = output["choices"][0]["text"]
|
76 |
if len(text.strip()) > 1 and text.strip() not in ['', None, ' ']:
|
77 |
break
|
78 |
+
counter += 1
|
79 |
+
logs += f"Final attempt: {counter}\n"
|
80 |
|
81 |
if language in languages:
|
82 |
logs += f"\nTranslating from en to {language}"
|