Spaces:
Sleeping
Sleeping
Commit
·
28433a3
1
Parent(s):
c0799ff
Update app.py
Browse files
app.py
CHANGED
@@ -38,17 +38,16 @@ def complete(prompt, stop=["User", "Assistant"]):
|
|
38 |
output += result
|
39 |
for word in stop:
|
40 |
if word in output:
|
41 |
-
|
42 |
-
return [output, token_count]
|
43 |
-
print(result, end='', flush=True)
|
44 |
|
45 |
-
|
46 |
-
return [output, token_count]
|
47 |
|
48 |
def greet(question):
|
49 |
print(question)
|
50 |
output, token_count = complete(f'User: {question}. Can you please answer this as informatively but concisely as possible.\nAssistant: ')
|
51 |
-
|
|
|
|
|
52 |
|
53 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
54 |
iface.launch(share=True)
|
|
|
38 |
output += result
|
39 |
for word in stop:
|
40 |
if word in output:
|
41 |
+
return output, token_count
|
|
|
|
|
42 |
|
43 |
+
return output, token_count
|
|
|
44 |
|
45 |
def greet(question):
|
46 |
print(question)
|
47 |
output, token_count = complete(f'User: {question}. Can you please answer this as informatively but concisely as possible.\nAssistant: ')
|
48 |
+
response = f"Response: {output} | Tokens: {token_count}"
|
49 |
+
print(response)
|
50 |
+
return response
|
51 |
|
52 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
53 |
iface.launch(share=True)
|