Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -50,18 +50,21 @@ def generate(item: Item):
|
|
50 |
details=item.details,
|
51 |
return_full_text=item.return_full_text
|
52 |
)
|
53 |
-
return stream
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
# return output
|
64 |
|
|
|
65 |
# def generate(item: Item):
|
66 |
# temperature = float(item.temperature)
|
67 |
# if temperature < 1e-2:
|
|
|
50 |
details=item.details,
|
51 |
return_full_text=item.return_full_text
|
52 |
)
|
53 |
+
# return stream
|
54 |
+
output = ""
|
55 |
|
56 |
+
for response in stream:
|
57 |
+
Check if response has the attribute 'token'
|
58 |
|
59 |
+
if hasattr(response, 'tokens'):
|
60 |
+
output += response.token.text
|
61 |
+
else:
|
62 |
+
output += response # If not, treat it as a string
|
63 |
+
|
64 |
+
return ['msg': output]
|
65 |
# return output
|
66 |
|
67 |
+
|
68 |
# def generate(item: Item):
|
69 |
# temperature = float(item.temperature)
|
70 |
# if temperature < 1e-2:
|